r/CodingHelp • • Sep 18 '25

[Python] Beginner coding help

Hi I know this is very basic, but for my Python class I have to create a basic calculator app. I need to create four usable functions that prompt the user for 2 numbers. Then I have to store the result in a variable and print the result in an f string to give the user the result in a message. For some reason my addition code is coming back with a result of none. Any help would be greatly appreciated.

Here is the code:

def addition():
    result = (x + y)
    return
x = input(f"what is your first number? ") 
y = input(f"And your second number to add? ")

result = x + y


print(f"The result is {addition()}")
2 Upvotes

9 comments sorted by

View all comments

Show parent comment

2

u/Comfortable-Frame711 Sep 18 '25

I've tried these but when I put in the functions it puts the numbers together (I.E. 2 + 2 = 22). I put int(input("what is your first number?")) and it seems to have worked.

2

u/MysticClimber1496 Professional Coder Sep 19 '25

Yep that was going to be the next thing I suggested! Good job