If we use 'if' instead of 'while' why the code gives only number 1 as output but if we give 'while' the output comes correctly?
@GeekTutorials13 жыл бұрын
Well spotted. 2 very different coding concepts.
@chasingmediocrity72085 жыл бұрын
end = input("what should I count to?") start = input("where should I start counting?") ending = int(end,10) starting = int(start,10) while ending != starting: starting = starting + 1 print(starting) #This'll let you determine where it starts and stops as well. This way you don't need to change the code to count to higher numbers, or to start at a number that isn't 0.