0
I dont know how to put multiple input to a list can u help me?
num=input() sum=0 for x in num : if int(x) %2 ==0 : sum+=int(x) print(sum) I have to take multiple input and cuclate sum of them but it count only the first num as input i tryed list(input()) but didnt work
2 Answers
+ 5
input accepts only string value so if you want to take multiple inputs you have to take inputs with space like 1 2 3 4 5 6
inp = input()
lis = inp.split(' ')
This will give list
Or your number of inputs should be fix:
like take 5 inputs
So in this case you can use loop:
x = int(input())
i = 0
lis = []
while i < x:
lis.append(int(input())
i += 1
print (lis)
+ 3
Parsa Nazer
Please move your code link into post Description, links do not work if you put them in post title or tags
https://code.sololearn.com/W3uiji9X28C1/?ref=app