Input output and operator
In Python all is input ("")
name = input () #输入的值会直接赋值给name
Name = input ("Please enter your name:") # ("") in the words to enter the prompt message
Here's how:
Input:
Python3 is all input ("")
Input ()
name = input () #输入的值会直接赋值给name
Name = input ("Please enter your name:") # ("") in the words to enter the prompt message
Ps:
The value you enter is assigned directly to name.
Input value is str type if you want to enter a value of a numeric type, you can: name = Int (input ()) Other types of input methods are identical.
Output:
Output the name value just now. (with text hint)
1. Print ("Name:", name)
2. Print ("Name:%s"%name) #% represents the placeholder s that is the character corresponding to the% following
A second way is recommended because you can control where the print is located.
Ps:
Operator:
Arithmetic operators:
Define two variables A = ten B = 20
Assignment operators:
comparison operators:
logical operators:
Small Knowledge Points:
A python file can be any suffix name because it is an explanatory language, so its suffix is independent of the file run. But it is recommended that everyone use the. py suffix. This also facilitates differentiation.
Python Basics 2