Skip to content

Commit 6acf027

Browse files
committed
Level 5
1 parent f4f55b5 commit 6acf027

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

Level5.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
def funktion():
2+
print("Hallo!")
3+
4+
5+
funktion()
6+
# OUT: Hallo!
7+
def funktion(text):
8+
print(text)
9+
10+
11+
funktion("a")
12+
# OUT: a
13+
def funktion(text, wirklich):
14+
if wirklich:
15+
print(text)
16+
17+
18+
19+
20+
funktion("Hallo", True)
21+
# OUT: Hallo
22+
funktion(True, "Hallo")
23+
# OUT: True
24+
25+
>>> def funktion(text="Beispiel" , wirklich=False):
26+
... if wirklich:
27+
... print(text)
28+
...
29+
...
30+
...
31+
>>> funktion()
32+
>>> funktion(wirklich=True)
33+
Beispiel
34+
>>> funktion(wirklich=True, text="Abc")
35+
Abc
36+
37+
>>> def ja():
38+
... return "Ja"
39+
...
40+
>>> ja()
41+
'Ja'
42+
43+
44+
#Rekusion
45+
46+
def fun():
47+
print("Fun!")
48+
fun()
49+
50+
#Zeit
51+
52+
>>> import time
53+
>>> time.time()
54+
1444327310.2887266
55+
>>> time.localtime()
56+
time.struct_time(tm_year=2015, tm_mon=10, tm_mday=8, tm_hour=20, tm_min=2, tm_sec=11, tm_wday=3, tm_yday=281, tm_isdst=1)
57+
>>> time.localtime()[0]
58+
2015
59+
>>> list(time.localtime())
60+
[2015, 10, 8, 20, 3, 1, 3, 281, 1]
61+
>>> time.localtime().tm_year
62+
2015
63+
64+
#Ladebalken
65+
66+
>>> import time
67+
>>> while True:
68+
... print(".", end="")
69+
... time.sleep(1)
70+
...
71+
...
72+
...........................................
73+
74+
#Quersumme
75+
76+
>>> def quersumme(zahl):
77+
... qs = 0
78+
... for ziffer in str(zahl):
79+
... qs += int(ziffer)
80+
...
81+
... return qs
82+
...
83+

0 commit comments

Comments
 (0)