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 ac74fe3

Browse files
Merge pull request #10 from Manavalan2517/Manavalan2517
Manavalan2517/solved-errors
2 parents d30ec29 + 5d26cad commit ac74fe3

File tree

5 files changed

+62
-23
lines changed

5 files changed

+62
-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":

‎Quiz-Creator/quiz.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
class QuizCreation:
3+
def process(self, question, choices, answer, question_number=""):
4+
choices_dict = {'a':1, 'b':2, 'c':3, 'd':4}
5+
with open("sample.txt", "a") as f:
6+
f.write(f"\nQUESTION {question_number}:- "+question)
7+
f.write("\n")
8+
count = 65
9+
for i in range(len(choices)):
10+
f.write(f"({chr(count)}) "+choices[i])
11+
f.write("\n")
12+
count += 1
13+
f.write(f"Answer :- ({answer.upper()}) "+choices[choices_dict[answer]-1])
14+
f.write("\n")
15+
16+
def open_file(self):
17+
os.startfile("sample.txt")
18+
19+
Quiz = QuizCreation()

‎Quiz-Creator/sample.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from quiz import Quiz
2+
3+
Quiz.process(question="Entomology is the science that studies",
4+
choices=["Behavior of human beings", "Insects", "The origin and history of technical and scientific terms", "The formation of rocks"],
5+
answer="b")
6+
7+
Quiz.open_file()

‎Quiz-Creator/sample.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
QUESTION :- Entomology is the science that studies
3+
(A) Behavior of human beings
4+
(B) Insects
5+
(C) The origin and history of technical and scientific terms
6+
(D) The formation of rocks
7+
Answer :- (B) Insects

‎README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@
3737
| 25 | [Quiz Master](./0x25-QuizMaster) |
3838
| 26 | [Dice-Simulator](./Dice-Simulator) |
3939
| 27 | [JSON-to-CSV](./JSON-to-CSV) |
40+
41+
| 28 | [Memory Game Python](./Memory-Game-Python) |
42+
| 29 | [Quiz-Creator](./Quiz-Creator) |
43+
4044
| 28 | [Memory-Game-Python](./Memory%20Game%20Python) |
4145

4246

47+
4348

4449
## User Guide
4550

@@ -76,7 +81,11 @@ flowchart LR
7681
<td align="center" valign="top" width="14.28%"><a href="http://github.com/dayoonasanya"><img src="https://avatars.githubusercontent.com/u/115120777?v=4?s=100" width="100px;" alt="dayoonasanya"/><br /><sub><b>Adedayo Onasanya</b></sub></a><br /><a href="https://github.com/victorpreston/Python-Projects/commits?author=dayoonasanya" title="Code">💻</a></td>
7782
<td align="center" valign="top" width="14.28%"><a href="https://github.com/atugharajohn"><img src="https://avatars.githubusercontent.com/u/92631399?v=4?s=100" width="100px;" alt="Atughara John"/><br /><sub><b>Atughara John</b></sub></a><br /><a href="https://github.com/victorpreston/Python-Projects/commits?author=atugharajohn" title="Code">💻</a></td>
7883
<td align="center" valign="top" width="14.28%"><a href="https://github.com/levoski1"><img src="https://avatars.githubusercontent.com/u/113690452?v=4?s=100" width="100px;" alt="levoski1"/><br /><sub><b>Ugwoke Levi</b></sub></a><br /><a href="https://github.com/victorpreston/Python-Projects/commits?author=levoski1" title="Code">💻</a></td>
84+
85+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Manavalan2517"><img src="https://avatars.githubusercontent.com/u/112639423?v=4" width="100px;" alt="Manavalan"/><br /><sub><b>Manavalan</b></sub></a><br /><a href="https://github.com/Manavalan2517" title="Code">💻</a></td>
86+
7987
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Manavalan2517"><img src="https://avatars.githubusercontent.com/u/112639423?v=4?s=100" width="100px;" alt="Manavalan2517"/><br /><sub><b>Manavalan</b></sub></a><br /><a href="https://github.com/victorpreston/Python-Projects/commits?author=Manavalan2517" title="Code">💻</a></td>
88+
8089
</tr>
8190
</tbody>
8291
</table>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /