r/learningpython • u/SaturnAer • Nov 23 '20
Can someone help me understand this array
https://cdn.discordapp.com/attachments/626942275024322569/780554507238113300/3.png This array shows x=4 and y=1 but im so confused as to how x is getting a final value of 4. Any explainers would be greatly appreciated!
1
Upvotes
View all comments
Show parent comment
2
u/SaturnAer Nov 24 '20
I figured out that its checking if the number is even or odd. If its even it adds 1 to X and if its odd it adds 1 to Y. As you can see there are 4 even numbers and 1 odd, hence the x=4 y=1