-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoutputs.py
More file actions
85 lines (53 loc) · 1.41 KB
/
outputs.py
File metadata and controls
85 lines (53 loc) · 1.41 KB
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
64
65
66
67
68
69
70
71
spam = [1, 3, 2, 5, 4, 7, 6, 9, 8, 10]
print(spam[int(int('3' * 2) // 11)])
# ------------------------------------------------------
spam = ['cats', 'dogs', 'moose']
bacon = ['dogs', 'moose', 'cats']
print(spam == bacon)
# ------------------------------------------------------
eggs = {'name': 'Zophie', 'species': 'cats', 'age': '8'}
ham = {'species': 'cats', 'age': '8', 'name': 'Zophie'}
print(eggs == ham)
# ------------------------------------------------------
class A(object):
x = 1
class B(A):
pass
class C(A):
pass
print(A.x, B.x, C.x)
B.x = 2
print(A.x, B.x, C.x)
A.x = 3
print(A.x, B.x, C.x)
# ------------------------------------------------------
def func1(bar=[]):
bar.append('xyz')
return bar
print(func1())
def func2(bar=[]):
bar.extend('xyz')
return bar
print(func2())
# ------------------------------------------------------
a = True
b = False
c = False
if a or b and c:
print('Python')
else:
print('mca101')
# ------------------------------------------------------
spam = 'SpamSpamEggsampSampS'
print(spam.strip('ampS'))
print(spam.strip('Spam'))
# ------------------------------------------------------
class Vehicle:
pass
class Truck(Vehicle):
pass
print(isinstance(Vehicle(), Vehicle))
print(type(Vehicle()) == Vehicle)
print(isinstance(Truck(), Vehicle))
print(type(Truck()) == Vehicle)
# ------------------------------------------------------