Назви A-z, 0-9 та _
- x = 5
- _y = 10
- resalt = None
- x, y, z = 1, 2, 3
- x = y = z = "Green"
1f = 8- ю2
- y-4
- my x
| Text | str "Hello World" #x = str("Hello World") |
| Numeric | int 1 #x = int(1) float 0.5 #x = float(0.5) complex 1j #x = complex(1j) |
| Sequence | list ["a", "b", "c"] #x = list(("a", "b", "c")) tuple ("a", "b", "c") #x = tuple(("a", "b", "c")) range range(6) #x = range(6) |
| Mapping | dict {"name" : "Andrew", "age" : 124} #x = dict(name="Andrew", age=124) |
| Set | set {"a", "b", "c"} #x = set(("a", "b", "c")) frozenset frozenset({"a", "b", "c"}) #x = frozenset(("a", "b", "c")) |
| Boolean | bool x = True #x = bool(5) |
| Binary | bytes b"Hello" #x = bytes(5) bytearray bytearray(7) #x = bytearray(7) memoryview memoryview(bytes(7)) #x = memoryview(bytes(7)) |
| None | NoneType #x = None |
Вказати тип даних
x = str(1) # x will be '1'
y = int(2) # y will be 2
z = float(3) # z will be 3.0
x = 2070
print(type(x)) #<class 'int'>
#This is a comment
"""
Multiline
Comment
"""
z = complex(1, 2)
print(z.real)
print(z.imag)