186k views
1 vote
Ask the user to input a number less than 100. Print all the numbers from that number to 100.

Which loop correctly does this?


num = int (input("Enter a number between 1 and 100: "))
c = num

while (num 100):
print (c)
c = c + 1

num = int (input("Enter a number between 1 and 100: "))
c = num

while (c <= 100):
print (c)
c = c + 1

2 Answers

1 vote

Answer:

num = int (input("Enter a number between 1 and 100: "))

c = num

while (c <= 100):

print (c)

c = c + 1

Step-by-step explanation:

User Ron Skufca
by
5.0k points
4 votes

Answer:

The second one:

num = int (input("Enter a number between 1 and 100: "))

c = num

while (c <= 100):

print (c)

c = c + 1

Step-by-step explanation:

First of all, you don't know Python... (LEARN IT)

Second of all, The first loop doesn't make sense? num 100

And the second one works, you can try compiling it (lazy to explain...).

User Sebastian Castaldi
by
4.9k points