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

Popular posts from this blog

PYTHON PROGRAM THAT GENERATES A RANDOM NUMBER BETWEEN 1 AND 10 AND ASKS THE USER TO GUESS THE NUMBER

PYTHON PROGRAM TO PRINT TOTAL AND AVERAGE OF THREE NUMBERS

PYTHON PROGRAM THAT USES FOR LOOP TO PRINT THE NUMBERS 8,11,14,17,20,.........,83,86,89