Skip to content

Commit fe52bda

Browse files
authored
Draw.py
1 parent c0b68a7 commit fe52bda

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Drawing Guess AI/drawing.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import random
2+
3+
def choose_word():
4+
words = ["apple", "banana", "car", "dog", "elephant", "flower", "guitar", "house", "ice cream", "jacket"]
5+
return random.choice(words)
6+
7+
def draw_object(word):
8+
print(f"Draw a {word} on the screen.")
9+
10+
def guess_object():
11+
guess = input("Enter your guess: ").lower()
12+
return guess
13+
14+
def main():
15+
print("Welcome to Drawing Guess AI!")
16+
word_to_draw = choose_word()
17+
draw_object(word_to_draw)
18+
19+
while True:
20+
user_guess = guess_object()
21+
22+
if user_guess == word_to_draw:
23+
print("Congratulations! You guessed it correctly.")
24+
break
25+
else:
26+
print("Oops! That's not the right guess. Try again!")
27+
28+
if __name__ == "__main__":
29+
main()

0 commit comments

Comments
 (0)