-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathforloop.py
More file actions
15 lines (12 loc) · 770 Bytes
/
Copy pathforloop.py
File metadata and controls
15 lines (12 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#Demonstration of For Loop, asks for a number and stores that number, counts up to 100, and counts the difference between the number entered and 100
#Define Variablres
numberstr = input("Please enter a number: ")
numberint = int(numberstr)
print(f"{numberint}, {numberstr}") #Starting point
for numberint in range(numberint, 101): #As long as the number entered +count is less than or equal to 100, run this loop
print(f"int:{numberint}, str:{numberstr}")
numberint += 1 #increases numberint, so loop does not run infinitely
numberint -= 1 #Reduces numberint by 1, so it does not read 101
#109print(f"Iterations: {iteration}")
print(f"Original Number: {numberstr}")
print(f"Final Number: {numberint}")