forked from lvgl/lv_micropython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
features.py
205 lines (164 loc) · 2.43 KB
/
features.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
try:
str.count
except AttributeError:
print("SKIP")
raise SystemExit
# mad.py
# Alf Clement 27-Mar-2014
#
zero = 0
three = 3
print("1")
print("2")
print(three)
print("{}".format(4))
five = 25 // 5
print(int(five))
j = 0
for i in range(4):
j += i
print(j)
print(3 + 4)
try:
a = 4 // zero
except:
print(8)
print("xxxxxxxxx".count("x"))
def ten():
return 10
print(ten())
a = []
for i in range(13):
a.append(i)
print(a[11])
print(a[-1])
str = "0123456789"
print(str[1] + str[3])
def p(s):
print(s)
p("14")
p(15)
class A:
def __init__(self):
self.a = 16
def print(self):
print(self.a)
def set(self, b):
self.a = b
a = A()
a.print()
a.set(17)
a.print()
b = A()
b.set(a.a + 1)
b.print()
for i in range(20):
pass
print(i)
if 20 > 30:
a = "1"
else:
a = "2"
if 0 < 4:
print(a + "0")
else:
print(a + "1")
a = [20, 21, 22, 23, 24]
for i in a:
if i < 21:
continue
if i > 21:
break
print(i)
b = [a, a, a]
print(b[1][2])
print(161 // 7)
a = 24
while True:
try:
def gcheck():
global a
print(a)
gcheck()
class c25:
x = 25
x = c25()
print(x.x)
raise
except:
print(26)
print(27 + zero)
break
print(28)
k = 29
def f():
global k
k = yield k
print(next(f()))
while True:
k += 1
if k < 30:
continue
break
print(k)
for i in [1, 2, 3]:
class A:
def __init__(self, c):
self.a = i + 10 * c
b = A(3)
print(b.a)
print(34)
p = 0
for i in range(35, -1, -1):
print(i)
p = p + 1
if p > 0:
break
p = 36
while p == 36:
print(p)
p = 37
print(p)
for i in [38]:
print(i)
print(int(exec("def foo(): return 38") == None) + foo())
d = {}
exec("def bar(): return 40", d)
print(d["bar"]())
def fib2(n):
result = []
a, b = 0, 1
while a < n:
result.append(a)
a, b = b, a + b
return result
print(fib2(100)[-2] - 14)
Answer = {}
Answer["ForAll"] = 42
print(Answer["ForAll"])
i = 43
def f(i=i):
print(i)
i = 44
f()
print(i)
while True:
try:
if None != True:
print(45)
break
else:
print(0)
except:
print(0)
print(46)
print(46 + 1)
def u(p):
if p > 3:
return 3 * p
else:
return u(2 * p) - 3 * u(p)
print(u(16))
def u49():
return 49
print(u49())