Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bfec9be

Browse files
Update main.py
1 parent f8f91ad commit bfec9be

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

β€ŽMemory Game Python/main.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,15 @@
99
progress = True
1010
competed = False
1111

12-
user_choice_data = input("""
13-
For '2x2' enter "EASY"
14-
For '4x4' enter "MEDIUM"
15-
For '6x6' enter "HARD"
16-
For '8x8' enter "EXTREME"
17-
18-
Enter your choice: """).lower()
19-
20-
while user_choice_data not in ["easy", "medium", "hard", "extreme"]:
21-
os.system("cls")
22-
user_choice_data = input("""
23-
For '2x2' enter "EASY"
24-
For '4x4' enter "MEDIUM"
25-
For '6x6' enter "HARD"
26-
For '8x8' enter "EXTREME"
27-
28-
Enter your choice: """).lower()
29-
3012
def game_elements(num):
3113

3214
lst = []
3315
while len(lst) < num:
3416
row = []
3517
while len(row) < num:
36-
random_number = random.randint(1,10)
18+
random_number = random.randint(65,73)
3719
if random_number not in row:
38-
row.append(random_number)
20+
row.append(chr(random_number))
3921
lst.append(row)
4022
element = row.copy()
4123
random.shuffle(element)
@@ -64,7 +46,6 @@ def game_table(list_with_spaces):
6446
print(f"{table_heading[char_count]} | {list_with_spaces[i][0]} | {list_with_spaces[i][1]} | {list_with_spaces[i][2]} | {list_with_spaces[i][3]} |")
6547
print(" |---------|---------|---------|---------|")
6648
char_count += 1
67-
6849

6950
if user_choice_data == 6:
7051
print(" 0 1 2 3 4 5 ")
@@ -74,7 +55,6 @@ def game_table(list_with_spaces):
7455
print(" |-------|-------|-------|-------|-------|-------|")
7556
char_count += 1
7657

77-
7858
if user_choice_data == 8:
7959
print(" 0 1 2 3 4 5 6 7 ")
8060
print(" |-------|-------|-------|-------|-------|-------|-------|-------|")
@@ -83,7 +63,6 @@ def game_table(list_with_spaces):
8363
print(" |-------|-------|-------|-------|-------|-------|-------|-------|")
8464
char_count += 1
8565

86-
8766
list_with_spaces = [[' ' for _ in sublist] for sublist in main]
8867
while progress:
8968
os.system('cls')
@@ -133,6 +112,24 @@ def game_table(list_with_spaces):
133112
user_values = []
134113
temp_found = []
135114
while True:
115+
user_choice_data = input("""
116+
For '2x2' enter "EASY"
117+
For '4x4' enter "MEDIUM"
118+
For '6x6' enter "HARD"
119+
For '8x8' enter "EXTREME"
120+
121+
Enter your choice: """).lower()
122+
123+
while user_choice_data not in ["easy", "medium", "hard", "extreme"]:
124+
os.system("cls")
125+
user_choice_data = input("""
126+
For '2x2' enter "EASY"
127+
For '4x4' enter "MEDIUM"
128+
For '6x6' enter "HARD"
129+
For '8x8' enter "EXTREME"
130+
131+
Enter your choice: """).lower()
132+
136133
if user_choice_data == "easy":
137134
user_choice_data = 2
138135
if user_choice_data == "medium":

0 commit comments

Comments
(0)

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /