+ 1
Cant we use input function multiple times in a program?
I typed a code containing input function one after the other and compiler showed error compiling it. https://code.sololearn.com/cR4QA1PV7Oqj/?ref=app
2 Respostas
+ 9
The problem is that u are trying to assign the print function to a variable. Print function returns "None" meaning it doesn't actually return anything definitely doesn't return what it prints. So when u try to add "None" to "None" u will get an exception/error
If what u are trying to do is add the inputs , do;
s = input()
t = input()
result = int(s) + int(t)
#have to convert s and t to integers since input() takes a string
print(result)
+ 8
Yeah. Separate multiple inputs with a new line.