30.1k views
5 votes
Write a program that asks the user for their name and how many times to print it.

If I enter Ada and 3 it should print:

Ada
Ada
Ada

Which loop correctly does this?


name = input("Enter your name: ")
num = int (input("Enter a number: "))

c = 1

while (c > num):
print (name)
c = c + 1

name = input("Enter your name: ")
num = int (input("Enter a number: "))

c = 1

while (c <= num):
print (name)
c = c + 1

name = input("Enter your name: ")
num = int (input("Enter a number: "))

c = 1

while (num <= name):
print (name)
c = c + 1

name = input("Enter your name: ")
num = int (input("Enter a number: "))

c = 1

while (c <= num):
print (name)

User Matt Long
by
4.9k points

1 Answer

3 votes

Answer:

c = 1

while (c <= num):

print (name)

c = c + 1

Step-by-step explanation:

dont ask :)

User Matfillion
by
5.1k points