+ 1

How to make this work?

1. Write a program that asks the user for their name and how many times to print it. The program should print out the user’s name the specified number of times. This is my codes so far; name=int(input("Type name ")) num = int(input("How many times would you like to print the name? ")) a = name b = num for i in range(num): print(b) temp = a a = b b = temp + b

8th Feb 2023, 1:59 PM
Erika Abalora
2 Answers
+ 6
int(input()) expects an integer, using it to get a name which is a string will result in ValueError. change it to: name = input ("type name" ) this loop is enough to do the job . for i in range(num): print(name)
8th Feb 2023, 2:11 PM
Bahha┣
Bahha┣ - avatar
+ 3
thankyouuuuu Bahha
8th Feb 2023, 2:53 PM
Erika Abalora