Post

Python Programming
Python Programming@PythonPr·
90% of the beginners will answer this wrongly🤯🤯 Comment your answer 👇
Python Programming tweet media
English
27
2
99
13.1K
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@PythonPr Answer: A Solution: The main part is to figure out what the loop is over. range(0, 5, 2) produces a sequence of numbers - starting from 0 - up to, but excluding 5 - with increments of 2 So, the items in the range are: 0, 2, 4. Note that 6 won't be in there, as it's >=5. +
English
1
1
6
492
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@PythonPr So, i takes values 0, 2, 4 within the loop. x is initialized to 0. In the 1st iteration, i=0 is added to x. It remains 0. In the 2nd iteration, i=2 is added to x, making it 2. In the 3rd iteration, i=4 is added to x, making it 6. The loop ends. The value of x, 6 is printed.
English
0
0
1
55
Paylaş