-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvariable.py
63 lines (58 loc) · 921 Bytes
/
variable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def main():
"""
>>> a = 3
>>> b = 4
>>> a + b
7
>>> a - b
-1
>>> a * b
12
>>> a / b
0.75
>>> a // b
0
>>> a % b
3
>>> 3 ** 4
81
>>> type(3)
<class 'int'>
>>> type(3.14)
<class 'float'>
>>> type('a')
<class 'str'>
>>> type("abc")
<class 'str'>
>>> type(True)
<class 'bool'>
>>> type(None)
<class 'NoneType'>
>>> type(3 + 4j)
<class 'complex'>
>>> int(3.14)
3
>>> int(-3)
-3
>>> float("3.14")
3.14
>>> str(3.14)
'3.14'
>>> str(3 + 4j)
'(3+4j)'
>>> chr(65)
'A'
>>> chr(97)
'a'
>>> ord("a")
97
>>> ord("A")
65
>>> chr(ord('a') - 32)
'A'
>>> chr(ord('A') + 32)
'a'
"""
if __name__ == "__main__":
from doctest import testmod
testmod()