+ 1

Can i get some help here . Where is the wrong in this code

total = 0 x=1 while(x<5): age = input() if(age<3): continue elif(age>=3): total +=100 x+=1 print(total)

15th Mar 2022, 3:31 PM
وضاح الهزايمة
7 Answers
+ 2
It asks inputs until, 4 inputs must be of age >= 3 , just ingores any number of input <3. if age <3 , it won't update x. condition must be x<=5 since you start from 1 #corrected code : وضاح الهزايمة total = 0 x=1 while(x<=5): x+=1 age = input() if(age<3): continue else: total +=100 print(total) edit: defaultly input is of string type so you need to convert to required type... age = int( input() )
15th Mar 2022, 3:49 PM
Jayakrishna 🇮🇳
+ 1
What? Edit: وضاح الهزايمة Oh. It have error. I did not checked output. total = 0 x=1 while(x<=5): x+=1 age = int(input()) #you need to cast to int if(age<3): continue else: total+=100 print(total)
15th Mar 2022, 4:08 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 thanks broo❤️❤️
15th Mar 2022, 4:13 PM
وضاح الهزايمة
0
You are making a ticketing system. The price of a single ticket is $100. For children under 3 years of age, the ticket is free. Your program needs to take the ages of 5 passengers as input and output the total price for their tickets. This is the question solve it plz
15th Mar 2022, 3:53 PM
وضاح الهزايمة
15th Mar 2022, 3:56 PM
وضاح الهزايمة
0
print(sum([100 if int(input(":"))>3 else 0 for i in range(5)]))
15th Mar 2022, 4:05 PM
Shadoff
Shadoff - avatar
0
Shadoff thanks bro ❤️❤️
15th Mar 2022, 4:13 PM
وضاح الهزايمة