Greet with a name and number of exclamation marks

Report a typo

You are given a name and a positive integer. You are required to print a greeting message using the name and a number of exclamation marks equal to the given integer. For example, if the given name is 'John' and the integer is 3, the output should be 'Hello, John!!!'. You will first take a string as input representing the name and then take an integer as input representing the number of exclamation marks.

Sample Input 1:

John
3

Sample Output 1:

Hello, John!!!

Sample Input 2:

Alice
1

Sample Output 2:

Hello, Alice!
Write a program in Python 3
# The Python built-in function 'input' is used to read a line of text from standard input.

# First we need to take the name as string from user input
name = input()

# Now, we need to take an integer representing the number of exclamation marks
num = int(input())

# TODO: Now you need to print the greeting message using the name and the number of exclamation marks.
# You need to use the String formatting techniques here. There are several ways to format strings in python, choose the one you are most comfortable with.

Create a free account to access the full topic