- 3
Suddenly appearedđ (x%2) in fact I don't know what means! ?? Anyone can explain that ?
What is 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
2 Answers
+ 3
x%2 returns remainder of x divided by 2.
There prints 5 because 5%2==1 and 5>4 is true
5//2=2 integer division
5%2=1 remainder
5/2=2.5 float division
0
Please take a look at the forum rules:
https://www.sololearn.com/Content-Creation-Guidelines/
https://www.sololearn.com/Discuss/1316935/?ref=app
Take a look at these guides on how to ask a question.
https://stackoverflow.com/help/how-to-ask
https://www.sololearn.com/blog/38/8-simple-rules-to-get-help-from-the-community
Please always tag the language you're asking about.
https://code.sololearn.com/W3uiji9X28C1/?ref=app