name = " Daming "
print(" My name is %s, Please take good care of me !" % name)
Take an integer variable
student_no = 1
print(" My student number is %06d" % student_no)
floating-point
price = 8.5
weight = 7.5
money = price *weight
print(" Apple unit price %.2f element / Jin , bought %.2f element / Jin , Need to pay %.4f element %(price,weight,money))
Define a decimal scale, The output data scale is 10.00%
scale = 0.1
print(" The data scale is %.2f%% %(scale *100))
Letter , Underline , Digital composition
Cannot start with a number
Cannot have the same name as the keyword
Has a special identifier
import: Import a toolkit
python Identifiers in are case sensitive
= There should be a space left and right
python in , If the variable name needs to be composed of two or more words , You can name it in the following way
Use lowercase letters for each word
Use... Between words _ Underline connection
Hump naming hair
Little hump
The first word begins with a lowercase letter , Follow on initial capital
Hump
The first letter of each word is capitalized
if The conditions to judge
When conditions are met , What to do
The code is indented with a tab key , perhaps 4 A space – Spaces are recommended