Program 3: Print the name of user as input - 1000+ Python Programs

Question 3)

Write a program in Python 3 to print the name of the user as input.


Write a Python Program to take the user name as input using input() function and print it in the console.

Code Example:

Print User Name as input - Python Program
# Program 3
# Print user name as input
# 1000+ Python Programs by

user_name = input("Hello! Enter your name: ")
print(f"Hello, {user_name}!")
Hello! Enter your name: Mike Alan
Hello, Mike Alan!


We have made use of two functions here,

  • input() - an inbuild function in Python 3 - read more...
  • print(prompt) - an inbuild function again, with the prompt string that is printed out to the standard output without a trailing newline - read more...
Gif Demo of Program with input function

The user name is saved in the variable user_name and printed using the print function with Literal String Interpolation, also know as as f-strings

Do read more on f-strings:


Have Questions? Post them here!

Top Hashtags: