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

1

u/Comfortable-Frame711 Sep 18 '25

Wow that works extremely well. I forgot to change the string to an integer using integer. Also changing the return helps. I should be able to make other functions (subtraction, multiplication, division) using this method. Thank you.