Basic data types
6 standard data types
number (digital), Sttring (string), List (list), Tuble (tuple), Set (collection), Dictionary (dictionary)
Immutable data: Number, String, Tuble
Variable Data: List, Dictionary, Set
string (string)
= str1 "Hello" str2 = "World" adder # string print (str1 + str2) multiplying string print (str * 3)
number (Digital)
int (integer)
. 1 = num1 num2 =. 3 num3 + = num1 num2 num3 = num1 - num2 num3 * = num1 num2 num3 = num1 / num2 # exponentiation, modulo, in addition to the floor num3 ** = num1 num2 num3% = num1 num2 num3 = num1 / / num2
Boolean value
True --> 1
False -->0
List
Tuple
dictionary
Operators
Arithmetic
Comparison operation
Assignment Operators
logic operation
Member operator
Identity operation
Bit computing
priority
More: rookie Tutorial
Statement
input Output
input()
print()
Conditional statements
if the basic statement
if condition: Internal code blocks inside block the else: ...
if nested
if 1 == 1: if 2 < 3: print("2<3") else: print('2>3')
if-elif
if 20 < 10: print("20<10") elif 20 > 10: print("20>10")
loop statement
while
n = 1 while n < 11: if n == 7: pass else: print(n) n = n + 1 print('----end----')
for
The pass statement
pass null code on behalf of that