-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (33 loc) · 663 Bytes
/
Copy pathmain.py
File metadata and controls
38 lines (33 loc) · 663 Bytes
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
def test1(n):
while n > 0:
print(n)
n = n - 1
def test2(n):
if n <= 0:
return
print(n)
test2(n - 1)
def test3(n):
for i in range(n):
for j in range(n):
for k in range(n):
print(i * j * k)
def test4(n):
print(n)
def test5(x, A):
# Suche x in A. A ist eine sortierte Liste.
print(x, A)
if len(A) == 0:
return False
m = int(len(A) / 2)
if A[m] > x:
return test5(x, A[:m])
elif A[m] < x:
return test5(x, A[m + 1:])
else:
return True
def test6(A):
i = 0
while i < len(A):
print(A[i])
i += 3