Suddenly appeared😂 (x%2) in fact I don't know what means! ?? Anyone can explain that ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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

30th Nov 2021, 11:12 AM
Alaa
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
30th Nov 2021, 11:18 AM
Jayakrishna 🇮🇳
30th Nov 2021, 5:39 PM
Simon Sauter
Simon Sauter - avatar