I realize this question may be duplicated here and here, I can't seem to understand the basic principle behind where a while loop reads a variable and, when updating said variable, why it no longer refers to the updated variable.
I want to query for a number and, if a hidden number b is less than the input, add 1 and print the result until b is no longer less than the input.
In this example, if the input number is 5, I want the output to be
3
4
5
I know this can be done with a for loop, but I would like to iterate in more complicated ways on b when I don't know how many times I need to iterate. I have tried this with the if as a while as well, with similar (non)-results. Thanks in advance.
a=raw_input("Input number: ")
b=2
while True:
if b<a:
b+=1
print b
else:
break
edit: Missed the 5 output, thanks.
a = int(raw_input("Input number:"))