0
Can i use more than one break in the same while function?
For example: x = float(input("Enter the studiet grade: ")) while True: if x <= 50: print ("failed") break continue elif 50 < x <= 70: print ("good") break continue elif 70 < x <= 90: print ("very good ") break continue elif 90 < x <= 100: print ("Excellent") break else : print ("Grade must be smaller than 100") break
4 Respuestas
0
@Rupam Das , but if i remove break it will be infinite loop
what is the solution ???
0
you can use multiple break statements .eg:inside if else statements.
only one break statement is executed.
was this helpful?
0
for a time only one if condition will execute in your cord,so here you should break statements inside every if condition
- 1
No you can not.
If you use break
while loop will be stopped
than using continue wont work