1.赋值操作符 Python语言中,等号(=)是主要的赋值操作符: >>> aInt=-100 >>> aString='this is a string' >>> aFloat=-3.1415*(6.3**2) >>> anotherString='Hello'+'World!' >>> print(aInt) -100 >>> print(aString) this is a string &g…
# Assign values directly a, b = 0, 1 assert a == 0 assert b == 1 # Assign values from a list (r,g,b) = ["Red","Green","Blue"] assert r == "Red" assert g == "Green" assert b == "Blue" # Assign val…
# assign values directly a = b = 'hello' a, b = 1, 2 print(b, type(b)) assert a == 1 and b == 2 # assign values from a list tt2 = [r, g, b] = ["Red", "Green", "Blue"] print(tt2, type(tt2)) # assign values from a tuple t3 = (x…