Raspithek
2 years ago
commit
2d9a26f05c
8 changed files with 88 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||||
|
# coding=utf-8 |
||||
|
|
||||
|
zahl = 99 |
||||
|
|
||||
|
if zahl == 100: |
||||
|
print ('Zahl ist einhundert.') |
||||
|
elif zahl > 100: |
||||
|
print('Zahl ist grösser als einhundert.') |
||||
|
else: |
||||
|
print('Zahl ist kleiner als einhundert.') |
@ -0,0 +1,6 @@ |
|||||
|
namen = ["World", "Homer", "Marge", "Bart"] |
||||
|
|
||||
|
for name in namen: |
||||
|
print("Hello " + name) |
||||
|
print('Das war es') |
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
namen = ["World", "Homer", "Marge", "Bart"] |
||||
|
|
||||
|
for name in namen: |
||||
|
print("Hello " + name) |
||||
|
if name == 'Marge': |
||||
|
print('-----------') |
||||
|
print('Das war es') |
@ -0,0 +1,8 @@ |
|||||
|
namen = ["World", "Homer", "Marge", "Bart"] |
||||
|
|
||||
|
for name in namen: |
||||
|
print("Hello " + name) |
||||
|
if name == 'Marge': |
||||
|
print('-----------') |
||||
|
|
||||
|
|
@ -0,0 +1,6 @@ |
|||||
|
zahl = 10 |
||||
|
|
||||
|
if zahl == 10: |
||||
|
print('Monks Lieblingszahl') |
||||
|
else: |
||||
|
print ('Mag Monk nicht so sehr') |
@ -0,0 +1,15 @@ |
|||||
|
name = 'Bart' |
||||
|
|
||||
|
if name == 'Marge': |
||||
|
print('Mutter') |
||||
|
elif name == 'Homer': |
||||
|
print('Vater') |
||||
|
elif name =='Bart' : |
||||
|
print('Sohn') |
||||
|
elif name == 'Lisa': |
||||
|
print('Tochter') |
||||
|
elif name == 'Maggie': |
||||
|
print('Baby') |
||||
|
else: |
||||
|
print('unbekannt') |
||||
|
|
@ -0,0 +1,30 @@ |
|||||
|
|
||||
|
# gleich |
||||
|
print('10 == 10 ist '+ str(10 == 10)) # liefert True |
||||
|
print ('10 == 11 ist ' + str(10 == 11)) # liefert False |
||||
|
|
||||
|
# groesser |
||||
|
print('----') |
||||
|
print('11 > 10 ist ' + str(11 > 10)) # liefert True |
||||
|
print('10 > 11 ist ' + str(10 > 11)) # liefert False |
||||
|
|
||||
|
# groesser gleich |
||||
|
|
||||
|
print('----') |
||||
|
print('10 >= 10 ist ' + str(10 >= 10)) # liefert True |
||||
|
print('10 >= 11 ist ' + str(10 >= 11)) # liefert False |
||||
|
|
||||
|
#kleiner gleich |
||||
|
|
||||
|
print('----') |
||||
|
print('10 <= 10 ist ' + str(10 <= 10)) # liefert True |
||||
|
print('11 <= 10 ist ' + str(11 <= 10)) # liefert False |
||||
|
|
||||
|
# ungleich |
||||
|
|
||||
|
print('----') |
||||
|
print('10 != 11 ist ' + str(10 != 11)) # liefert True |
||||
|
print('10 != 10 ist ' + str(10 != 10)) # liefert False |
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,6 @@ |
|||||
|
namen = ["World", "Homer", "Marge", "Bart"] |
||||
|
schleifenzaehler = 0 |
||||
|
|
||||
|
while schleifenzaehler < len(namen): |
||||
|
print("Hello " + namen[schleifenzaehler]) |
||||
|
schleifenzaehler += 1 |
Loading…
Reference in new issue