In: Computer Science
What is the last value of variable x?
y = 0 x = 0 while y<=10: if y%2==0: x = x + 2 y += 1
CODE :-
#I Have used comments for explanations
y = 0
x = 0
while y<=10:
if y%2==0:
#As the y%2 == 0 the x will be incremented
x = x +
2 # x will increment by two every time Y%2 ==
0
print(x) #Here we are placing print
statement to see the values of x
y +=
1
#every time y will increment by one until y<=10
Thank You...!