Python provides input from the standard input () built-in function to read a line of text, the default standard input is the keyboard,
1, what is the terminal
Python is the default run in a terminal window, the command line window commonly,
Terminal - human and machine interaction interface
Humans and machines are two separate entities, when people use the machine, must use some kind of interface (interface) to exchange information with machine, desktop interface includes monitor, keyboard, mouse, speakers, microphones, etc., CPU, memory, hard disks, optical drive, video card, network card belongs to the host (host) and other hardware, Unix and Linux call this makes humans and machines can be interactive interface terminal,
Generally, python running terminal is the command line window
2, the built-in function input
Grammar:
The variable name=Input (" prompt string)
Role: in the terminal display message, waiting for user input, press the return key (Enter) end, assigned to a variable,
Prompt string: before let user input, displayed on the screen prompt information
Note:
1, after the show message, will have been waiting for user input, if the user has no input end, have to stop here, does not execute the following code, after the input, the user on a carriage return and the end of the input,
2, the input () function returns the contents of the user input, are strings,
3, type conversion, if you need to input the number into numerical value, can use int, float function,
> A=int (input (" please enter an integer:))
> B=float (input (" please enter a decimal:))
4, a multiple input data, input the middle with commas,
> A, b=eval (input (" please enter the number two: "))
5, enter a python statements, and perform,
> The exec (input (" please enter a python statements "))