+ 2
Hi, who knows python well?
Is it possible to add multiple inputs on SoLolearn's terminal. If so, how can i? Have you ever tried ? a = input () b = input () print( a , b ) ???
8 Antworten
+ 3
Berdakh
Yes, just do
int(a) + int(b)
+ 4
Berdakh ,you have to give the input in seperate lines.
like that:
5
6
+ 3
#Enter each number seperated by a space, or leave empty for default
inp = input().strip().split() or list(range(1,6))
print(f'There are {len(inp)} inputs')
print(*inp, sep=' + ', end =f' = {sum(map(int,inp))}')
+ 2
if you write,
print(a,b)
the program will work but not give the result you expected.
the will first print the value of a then gap and then b.
+ 2
Enter multiple inputs in separate lines.
+ 2
You can use
input_list = list(map(int, input().split()))
then you enter like this:
1 2 3 4 5 # with whitespace
Now you have got list of input numbers:
print(input_list)
[1,2,3,4,5] # output
+ 1
I Am Groot ! Thanks for your respond but on the app (Sololearn), It is not giving some place to add second (third, etc) integer ???
0
a=eval(input())
b=eval(input())
print(a+b)
Input on separate line
Ex:
1
*Enter*
1
Output:
2