Appearance
How do I use raw_input in Python 3? โ
In Python 3, the input() function can be used in place of raw_input() to read input from the user. Here's an example of how to use the input() function to read a string from the user:
using input() function to read a string from user input
python
name = input("What is your name? ")
print("Hello, " + name + "!")
<div class="alert alert-info flex not-prose">Watch a video course Python - The Practical Guide
</div>
In this example, the input() function will display the string "What is your name? " and wait for the user to input a string, which will be stored in the variable name. The program will then print out "Hello, [name]!" using the value stored in the name variable.