Python Count up & Down loop
问题 How can I simply transform this loop to count up from 1 to 100, and display the numbers? I'm starting to code recently. It works fine when counting down, but I can't figure out how to make it go from 1 -100 example: count = 100 while count > 0 : print(count) count = count - 1 回答1: Start at 1, and change your conditional to break out when you reach 100. Add 1 each loop through. count = 1 while count <= 100: print(count) count += 1 回答2: If you use a for loop it gets really easy: for number in