Challenge:
Write a program that asks for a number, n, and then prints out all the numbers between 1 and n. Your program should work like this:
Enter a number: 7
1
2
3
4
5
6
7
my code so far:
n = int(input("Enter a number: "))
while n > 1:
print(n)
n = n + 1
But it just spams the number that I enter. I need it to count up to that number, how do I do it?
Write a program that asks for a number, n, and then prints out all the numbers between 1 and n. Your program should work like this:
Enter a number: 7
1
2
3
4
5
6
7
my code so far:
n = int(input("Enter a number: "))
while n > 1:
print(n)
n = n + 1
But it just spams the number that I enter. I need it to count up to that number, how do I do it?