-3

I looked it up and only found split() but couldnt use it, it gave an error. Is there a way to get all inputs at once.

total = 0
a = int(input("Enter your age"))
b = int(input("Enter your age"))
c = int(input("Enter your age"))
d = int(input("Enter your age"))
e = int(input("Enter your age"))

Age_List = [a, b, c, d, e]

for x in Age_List:
    if x > 3:
        total += 100
    else:
        continue
print(total)
0x5453
  • 12,753
  • 1
  • 32
  • 61
Yigit148
  • 11
  • 4

2 Answers2

0

To get list of 5 elements from input

x = [int(input()) for _ in range(5)]
0

You can take inputs inside loop.

total = 0
for i in range(5):
    age = int(input())
    if age > 3:
        total += 100
    else:
        continue
print(total)
Python learner
  • 1,159
  • 1
  • 8
  • 20