python learning the first day of the second day summary

Variable assignment

1, a variable ⺟ words, numbers, underscores combinations into ⽽
2, not the beginning of Use digital, not all digital
3, can not be pythond keywords, symbols and words ⺟ python has been accounted for using, it can not be changed
4. Do not Use the File
5, to be meaningful name
6, do not be too ⻓
7, the distinction between writing zoomed ⼩
Using the recommended zoomed home or underline hump body named
Hump ​​body: every other word except zoomed therefore especially word ⺟ therefore especially written word ⺟
Underline: Use an underscore between each word separately

count = 123 integer assignment

count = "ioiou" string assignment

print print variable of type (type (count)).

ptyhon types are integer, string, Boolean,  

count = "" this copy "

 

Note

# Single line

多行 """"  """ """

input function of user interaction input

 

Formatted output

# Formatted output (placeholders)% s behalf can only accept a string type can only accept on behalf of% d% f init receiving integer floating point 
#print ( "my name is% s I'm have a good wokr% s Zheng the salary S% WO "% (name, Work, Age))

# formatted output (.format) {} .format manner {0}, {1} .format () indexing {_name = name} .format assignment mode

= #info ( "My name IS {} have have the I'm A Good Work {} {} WO Zheng the salary" .format (name, Work, the salary))
"" "
Print (" My name IS {0}, Im IS Good Work {. 1}, WO Salay IS {2}. "the format (name, the salary, Work))
Print (" My name IS {the _name}, Im IS Good Work {_work}, WO Salay IS {_salary}. "the format (= the _name name, the salary = _salary, _work = Work))

# f-string format output mode
World = f'Hello {name}, the name My Work {IS} '
Print (World)
Print (F'my name is good boy, good work {work}')

 

if the judge

if conditions:

    action

 

while True infinite loop

Guess you like

Origin www.cnblogs.com/GYC-GXm/p/12079299.html
Recommended