Skip to content
Snippets Groups Projects
Commit ea0c786e authored by Markus Opolka's avatar Markus Opolka
Browse files

Add solutions

parent 467b419a
No related branches found
No related tags found
No related merge requests found
...@@ -21,3 +21,22 @@ def get_random_word(): ...@@ -21,3 +21,22 @@ def get_random_word():
'birthday'] 'birthday']
return random.choice(words) return random.choice(words)
def check_word(tries):
word = get_random_word()
while tries > 0:
guess = input("Bitte rate das Wort: ")
if guess == word:
print("Richtig geraten")
break
print("Falsch geraten. Du Depp!")
tries -= 1
print("Versuche übrig: {0}".format(tries))
check_word(tries=5)
...@@ -3,9 +3,29 @@ ...@@ -3,9 +3,29 @@
import sys import sys
def is_even(n):
def draw_pyramid(n): if n % 2 == 0:
pass return True
else:
return False
def draw_pyramid(size):
if is_even(size):
print("Bitte nur ungerade! Du Horst.")
return
height = 1
while (height < size):
print("=" * height)
height = height + 1
while (height > 0):
print("=" * height)
height = height - 1
def main(args): def main(args):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment