-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinalProject.py
More file actions
39 lines (33 loc) · 1.03 KB
/
FinalProject.py
File metadata and controls
39 lines (33 loc) · 1.03 KB
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
39
import time
def get_words(num_words):
print(f"Please enter {num_words} words:")
words = []
for i in range(num_words):
word = input(f"Word {i+1}: ")
words.append(word)
return words
def check_words(words):
print("\nNow, try to repeat the words you entered.")
for i in range(len(words)):
word = input(f"Word {i+1}: ")
if word != words[i]:
return False
return True
def memory_game():
round_number = 1
while True:
print(f"\nRound {round_number}")
num_words = round_number + 2
words = get_words(num_words)
print("\nMemorize these words (you will be asked to put them back in in 5 seconds):")
print(words)
time.sleep(5)
print("\n" * 50)
if check_words(words):
print("\nGreat job! You remembered all the words.")
round_number += 1
else:
print("\nOops! You didn't remember the words correctly.")
break
if __name__ == "__main__":
memory_game()