-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPCE.py
More file actions
26 lines (20 loc) · 797 Bytes
/
PCE.py
File metadata and controls
26 lines (20 loc) · 797 Bytes
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
import random
def generate_random_letters():
letters = []
for _ in range(3):
letter = chr(random.randint(65, 90))
letters.append(letter)
return letters
# Generate random letters
random_letters = generate_random_letters()
# Convert list of letters to a string
random_letters_str = ''.join(random_letters)
# Display the letters to memorize
print(f"Memorize these letters: {random_letters_str}")
# Ask the user to type the letters back in
user_input = input("Type the letters you memorized: ")
# Check if the input matches the generated random letters
if user_input.upper() == random_letters_str:
print("Congratulations! You remembered the letters correctly.")
else:
print(f"Oops! You typed '{user_input}'. The correct letters were '{random_letters_str}'.")