Hi, who knows python well? | Sololearn: Learn to code for FREE!


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 ) ???

12/13/2020 5:59:09 PM


8 Answers

New Answer


Berdakh Yes, just do int(a) + int(b)


Berdakh ,you have to give the input in seperate lines. like that: 5 6


#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))}')


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.


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


I Am Groot ! Thanks for your respond but on the app (Sololearn), It is not giving some place to add second (third, etc) integer ???


a=eval(input()) b=eval(input()) print(a+b) Input on separate line Ex: 1 *Enter* 1 Output: 2