+ 1
How to make a function and input it's arguments
I wanna make a function like this def func (Ă): return Func (input ()) But when I try I get an error
4 Answers
+ 5
You need to convert the inputs for both functions to int before you can use them for calculation. (input always returns string format whatever you input)
There is also a colon ":" missing at the end of header from second function.
def add(x,y):
return x+y
print(add(int(input()),int(input()))) #input needs to be converted to int
# and i also was tring this
def divide(x,y):
assert int(y)>0
return x/y
print(divide(int(input()),int(input()))) #input needs to be converted to int
+ 2
Can you show us the program?
0
https://code.sololearn.com/cZC99PcUcA5G/?ref=app