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 USES FOR LOOP TO PRINT THE NUMBERS 8,11,14,17,20,.........,83,86,89

PYTHON PROGRAM THAT ASKS THE USER TO ENTER TWO STRINGS OF SAME LENGTH AND WILL ALTERNATE THE CHARACTERS OF THE TWO STRINGS.FOR EXAMPLE: abcde and ABCDE THEN THE PROGRAM WILL PRINT AaBbCcDdEe

PYTHON PROGRAM THAT ASKS USER FOR LARGE INTEGERS AND INSERTS COMMAS INTO IT ACCORDING TO THE STANDARD AMERICAN CONVENTION FOR COMMAS IN LARGE NUMBERS