Classes/Spring 2025/ENGR 490/4/P4/Scripts/loops_demo.py

17 lines
234 B
Python

# Print numbers from 1 to 10 using a for loop
print("For Loop:")
for i in range(1,11):
print(i)
# Print numbers from 1 to 5 using a while loop
print("While Loop:")
count = 1
while count <= 5:
print(count)
count += 1