Skip to content

How to use input function in Python | Example code

  • by

Using the input() function is easy just use a variable to assign the input function. This variable will have a user input value.

This function is used when you want to interact with users.

x = input()

Example to use input function in Python

Simple example code uses the prompt parameter to write a message before the input() function.

print('Enter your name: ')
x = input()

print('Hello, ' + x)


How to use input function in Python

Do comment if you have any doubts and suggestions on this Python function topic.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Your email address will not be published. Required fields are marked *