Skip to content

Help in python code #21492

Discussion options

You must be logged in to vote

If you carefully watch each variable as you go through the loop, you will see they change like this:

cnt = 3
a=3
b=3
c=1

cnt = 4
a=5
b=5
c=3

cnt = 5
a=9
b=9
c=5

cnt = 6
a=15
b=15
c=9

The reason the last iteration runs is because before the while loop was entered, cnt was 5, thereby satisfying the condition cnt < 6

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants