How 11 will come?

Course Name: Python for Trading: Basic, Section No: 9, Unit No: 7, Unit type: Notebook



In a while loop condition a<=10:

a=a+1

print(a)

in this statement how 11 is printed?

11 is not equal to 10 and also it not less than or equal to 10.how come 11?

The printed value is actually a+1 (the previous line assigns a+1 to a (a=a+1). Therefore, when a=10, the next line adds 1 to that value making it 11.