1. Python Indent
Is the Python indent a tab or a space? All can, can be a tab, can also be 4 spaces, but most importantly, the entire Python script indentation must be unified, otherwise it will be an error.
2. Code Comment
There are two ways to annotate Python, as follows:
# This is a single-line comment "' This is a multiline comment here is a 3 single quote ~" "" " this is a multiline comment here is a 3 double quotation mark ~" "
3. Sentence break
#!/usr/bin/pythona=2;b=23 #python默认每行一条代码, but you can also separate two statements with a semicolon if a > b: print (a) # The indent statement is written after the colon else:p rint (b) print (a+b);p rint (' Hello Boy '); #使用分号将两条语句写在同一行
In Python, there is no difference between single and double quotes, which can be used to enclose strings, and this is the same as JS.
4. Receive input parameters
# !/usr/bin/pythona=input (" Please enter a:") b=input (" Please enter B: " if a > b: print(a) # indent statements are written after a colon else: print(b)
5. A case of mathematical operation
# !/usr/bin/python " " perform mathematical operations subtraction in Python, etc. " " Print (Action) Print # 2 of the 10-time Square Print (3*5/2) Print (3.0*5/2)
Print (99**99) # Python supports large integers
Python Learning-2 Python starter essentials