+ 1
An example use case of continue:
An example use case of continue: An airline ticketing system needs to calculate the total cost for all tickets purchased. Tickets for children under the age of 3 are free. We can use a while loop to iterate through the list of passengers and calculate the total cost of their tickets. Here, the continue statement can be used to skip the children. Total = 0 i = 1 while i <= 1: x = int(input()) i = i + 1 if x<3: continue else: Total += 100 print(total) SOMEONE CAN EXPLAIN ME THIS PROGRAM I CANT UNDERSTAND HOW TO THIS CODE EXECUTE
1 ответ
+ 9
PUSHPANJALI ,
sorry to say, but this code sample is a totally mess in terms of indentation.
since you have not started any python tutorial in sololearn upto now, it is recommended to start with your learning process now.
in *python for beginners* you can learn about loops, and also the *continue* statement.
happy coding and good success!