0
I can't solve this quiz, it's in python, please help
I need to output the sum of ticket prices of 5 persons in each quiz, the price per ticket is 100$, the age of the persons are 1, 2, 1, 2, 5 years old in the first quiz, and 20, 32, 1, 2, 1 years old in the second quiz, while persons under age 3 years old the ticket is for free, i need one code that gives two different outputs which are 100& 200, can you please help me to solve it? Because I'm stuck in this lesson for a month now because of this quiz, the quiz is in the lesson (break & continue) thanks in advance
4 odpowiedzi
+ 7
Wesam Sobhy ,
> can you please link your code here?
> without having seen your attempt it is difficult to figure out what the issue is.
+ 7
Wesam Sobhy ,
incorrect indentation is a major reason for your issue with this code.
additionally we should use 4 spaces per indentation level. this gives a good readability.
this is your code with some comments and amendments:
total=0 # wrong spelling, use *total* as done in in the last 2 lines of the code.
i=0
while i < 5:
i+=1
age= int (input ()) # missing closing parenthesis
if age < 3:
continue
total+=100
print (total)
+ 1
How, I'm not familiar with it, how can I share the link of my code here
+ 1
My code is
Total=0
i=0
while i < 5:
i+=1
age= int (input ()
if age <3:
continue
total+=100
print (total)
And this is the same code in the model answer, but it's still not working, the output says, continue is not in appropriate position
Please help me so that i can continue my course