Python, accepts input

in aPythonCommand line application, you can use the following command to display information to the userprint()Features:

name = "Roger"
print(name)

We can also accept input from users, usinginput():

print('What is your age?')
age = input()
print('Your age is ' + age)

This method gets input at runtime, which means that the program will stop executing and wait for the user to type something and pressenterkey.

You can also perform more complex input processing and accept input when the program is called. We will introduce how to deal with it later.

This applies to command line applications. Other types of applications will require different ways of accepting input.


More python tutorials: