PYTHON PROGRAM THAT ASKS USER FOR NAME AND HOW MANY TIMES TO PRINT IT
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
CODE:
name=input("Enter name:")
n=int(input("Number of times to print the name:"))
print(name*n)
EXPLANATION:
For sequences such as string, list and tuple, asterisk(star) * is a repetition operator.
For numeric data types, * is used as multiplication operator.
OUTPUT:
Comments
Post a Comment