def addition():
int(input1)
int(input2)
mysum = input1 input2
print(mysum)
input1: str = input("Enter integer #1 \n ")
input2: str = input("Enter integer #2 \n ")
addition()
I tried to convert the inputs to ints so that I could add them together but it just treats them like regularly doing:
print(text1("1") text2("1")
result: 11
I also tried to use sum() with a "for numbers in input1 and input2" statement but produced the same result.
CodePudding user response:
Change your function to this
def addition():
mysum = int(input1) int(input2)
print(mysum)
CodePudding user response:
The function should look like this:
def addition(number1, number2):
print(int(number1) int(number2))
input1 = input("Enter integer #1 \n ")
input2 = input("Enter integer #2 \n ")
addition(input1, input2)