- 1
What's the output of this code? list = [2, 3, 4, 5, 6, 7] for x in list: if(x%2==1 and x>4): print(x) break
Could anyone help me explain why the answer is 5 Am a beginner and i really want to understand it very well
3 Respuestas
+ 1
Opaal Henry do the python course. The code you posted is fundamental programming knowledge
0
The only case in which the condition of if statement is correct when x = 5 where 5%2=1 and 5>4 ... So the code will print 5 and break the loop ...
follow me to help you in your problems
0
Please fo the following things when posting a question:
1. Tag the language
2. Write it as code (not plain text)