-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maria Antipova
committed
Dec 7, 2024
1 parent
f7d4c45
commit 1b0bafb
Showing
4 changed files
with
193 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{"version": 2, "width": 120, "height": 30, "timestamp": 1733574049, "env": {"SHELL": "/bin/bash", "TERM": "xterm-256color"}} | ||
[0.025339, "o", "\u001b[?2004h\u001b]0;beril@HOME-PC: ~/python-project-49\u0007\u001b[01;32mberil@HOME-PC\u001b[00m:\u001b[01;34m~/python-project-49\u001b[00m$ "] | ||
[7.798315, "o", "pipx install dis"] | ||
[7.79895, "o", "t/*.whl"] | ||
[8.696856, "o", "\r\n\u001b[?2004l\r"] | ||
[8.867056, "o", "\u001b[?25l"] | ||
[8.875714, "o", "\r\u001b[K\r\u001b[K⣷ creating virtual environment"] | ||
[8.916775, "o", "\r\u001b[K"] | ||
[8.917003, "o", "\r\u001b[K"] | ||
[8.962915, "o", "\r\u001b[K\r\u001b[K"] | ||
[8.963126, "o", "⣷ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.063276, "o", "\r\u001b[K\r\u001b[K⣯ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.16343, "o", "\r\u001b[K\r\u001b[K⣟ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.263582, "o", "\r\u001b[K\r\u001b[K⡿ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.363691, "o", "\r\u001b[K\r\u001b[K⢿ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.46389, "o", "\r\u001b[K\r\u001b[K⣻ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.564045, "o", "\r\u001b[K\r\u001b[K⣽ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.664242, "o", "\r\u001b[K\r\u001b[K⣾ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[9.695223, "o", "\r\u001b[K\r\u001b[K"] | ||
[9.892989, "o", "'hexlet-code' already seems to be installed. Not modifying existing installation in\r\n'/home/beril/.local/share/pipx/venvs/hexlet-code'. Pass '--force' to force installation.\r\n"] | ||
[9.893189, "o", "\u001b[?25h"] | ||
[9.893324, "o", "\u001b[0m"] | ||
[9.912718, "o", "\u001b[?2004h\u001b]0;beril@HOME-PC: ~/python-project-49\u0007\u001b[01;32mberil@HOME-PC\u001b[00m:\u001b[01;34m~/python-project-49\u001b[00m$ "] | ||
[13.431152, "o", "pipx install dist/*.whl"] | ||
[15.071108, "o", " "] | ||
[15.197432, "o", "-"] | ||
[15.338088, "o", "-"] | ||
[16.173377, "o", "f"] | ||
[16.327188, "o", "o"] | ||
[16.473769, "o", "r"] | ||
[17.014344, "o", "c"] | ||
[17.097192, "o", "e"] | ||
[17.980629, "o", "\r\n\u001b[?2004l\r"] | ||
[18.084976, "o", "\u001b[?25l"] | ||
[18.091625, "o", "\r\u001b[K"] | ||
[18.092113, "o", "\r\u001b[K⣷ creating virtual environment"] | ||
[18.128637, "o", "\r\u001b[K\r\u001b[K"] | ||
[18.173404, "o", "\r\u001b[K\r\u001b[K⣷ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[18.273849, "o", "\r\u001b[K\r\u001b[K⣯ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[18.374027, "o", "\r\u001b[K\r\u001b[K⣟ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[18.47422, "o", "\r\u001b[K\r\u001b[K⡿ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[18.57441, "o", "\r\u001b[K\r\u001b[K⢿ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[18.674478, "o", "\r\u001b[K\r\u001b[K⣻ determining package name from '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[18.746646, "o", "\r\u001b[K"] | ||
[18.746892, "o", "\r\u001b[K"] | ||
[18.945612, "o", "Installing to existing venv 'hexlet-code'\r\n"] | ||
[18.945801, "o", "\r\u001b[K"] | ||
[18.945953, "o", "\r\u001b[K"] | ||
[18.946138, "o", "⣷ creating virtual environment"] | ||
[18.981978, "o", "\r\u001b[K\r\u001b[K"] | ||
[19.01495, "o", "\r\u001b[K\r\u001b[K"] | ||
[19.015175, "o", "⣷ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.1154, "o", "\r\u001b[K\r\u001b[K⣯ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.215525, "o", "\r\u001b[K\r\u001b[K⣟ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.315705, "o", "\r\u001b[K\r\u001b[K⡿ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.416574, "o", "\r\u001b[K\r\u001b[K⢿ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.516729, "o", "\r\u001b[K\r\u001b[K⣻ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.616832, "o", "\r\u001b[K\r\u001b[K⣽ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.716905, "o", "\r\u001b[K\r\u001b[K⣾ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.817086, "o", "\r\u001b[K\r\u001b[K⣷ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[19.917258, "o", "\r\u001b[K\r\u001b[K⣯ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[20.017453, "o", "\r\u001b[K\r\u001b[K⣟ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[20.117559, "o", "\r\u001b[K\r\u001b[K⡿ installing hexlet-code from spec '/home/beril/python-project-49/dist/hexlet_code-0.1.0-py3-none-any.whl'"] | ||
[20.215883, "o", "\r\u001b[K"] | ||
[20.216201, "o", "\r\u001b[K"] | ||
[20.313716, "o", " installed package \u001b[1mhexlet-code\u001b[0m \u001b[1m0.1.0\u001b[0m, installed using Python 3.12.3\r\n These apps are now globally available\r\n - brain-calc\r\n - brain-even\r\n - brain-games\r\n"] | ||
[20.313899, "o", "done! ✨ 🌟 ✨\r\n"] | ||
[20.314071, "o", "\u001b[?25h\u001b[0m"] | ||
[20.33714, "o", "\u001b[?2004h\u001b]0;beril@HOME-PC: ~/python-project-49\u0007\u001b[01;32mberil@HOME-PC\u001b[00m:\u001b[01;34m~/python-project-49\u001b[00m$ "] | ||
[23.210834, "o", "b"] | ||
[24.019083, "o", "r"] | ||
[24.149174, "o", "a"] | ||
[24.869919, "o", "i"] | ||
[25.243782, "o", "n"] | ||
[25.85843, "o", "-"] | ||
[26.168643, "o", "c"] | ||
[26.25605, "o", "a"] | ||
[26.497663, "o", "l"] | ||
[27.224498, "o", "c"] | ||
[27.961457, "o", "\r\n\u001b[?2004l\r"] | ||
[27.9771, "o", "Welcome to the Brain Games!\r\nMay I have your name? "] | ||
[28.984042, "o", "M"] | ||
[29.178397, "o", "a"] | ||
[29.510866, "o", "r"] | ||
[29.678794, "o", "i"] | ||
[29.855027, "o", "a"] | ||
[30.594039, "o", "\r\n"] | ||
[30.594198, "o", "Hello, Maria!\r\nWhat is the result of the expression?\r\n"] | ||
[30.59435, "o", "Question: 24 * 24\r\nyour answer: "] | ||
[42.476635, "o", "4"] | ||
[42.61265, "o", "7"] | ||
[43.047084, "o", "6"] | ||
[44.032699, "o", "\b \b"] | ||
[44.178703, "o", "\b \b"] | ||
[44.332518, "o", "\b \b"] | ||
[45.331057, "o", "5"] | ||
[45.843794, "o", "7"] | ||
[45.887532, "o", "6"] | ||
[47.013595, "o", "\r\nCorrect!\r\n"] | ||
[47.01381, "o", "Question: 97 - 85\r\nyour answer: "] | ||
[49.381526, "o", "2"] | ||
[49.55053, "o", "\r\n"] | ||
[49.550736, "o", "'2' is wrong answer:(. Correct answer was '12'.\r\nLet's try again, Maria!\r\n"] | ||
[49.555305, "o", "\u001b[?2004h\u001b]0;beril@HOME-PC: ~/python-project-49\u0007\u001b[01;32mberil@HOME-PC\u001b[00m:\u001b[01;34m~/python-project-49\u001b[00m$ "] | ||
[51.394663, "o", "b"] | ||
[51.715515, "o", "r"] | ||
[51.819156, "o", "a"] | ||
[52.260988, "o", "i"] | ||
[52.70115, "o", "n"] | ||
[53.082237, "o", "-"] | ||
[53.467945, "o", "c"] | ||
[53.580954, "o", "a"] | ||
[53.811534, "o", "l"] | ||
[53.906685, "o", "c"] | ||
[54.625577, "o", "\r\n\u001b[?2004l\r"] | ||
[54.641309, "o", "Welcome to the Brain Games!\r\nMay I have your name? "] | ||
[55.721408, "o", "M"] | ||
[55.912281, "o", "a"] | ||
[56.27158, "o", "r"] | ||
[56.48185, "o", "i"] | ||
[56.622551, "o", "a"] | ||
[57.13343, "o", "\r\n"] | ||
[57.133513, "o", "Hello, Maria!\r\nWhat is the result of the expression?\r\nQuestion: 18 + 5\r\n"] | ||
[57.133774, "o", "your answer: "] | ||
[62.846685, "o", "2"] | ||
[62.889803, "o", "3"] | ||
[63.638107, "o", "\r\n"] | ||
[63.638336, "o", "Correct!\r\nQuestion: 95 * 88\r\nyour answer: "] | ||
[69.507272, "o", "8"] | ||
[69.823435, "o", "3"] | ||
[70.732249, "o", "6"] | ||
[70.981269, "o", "0"] | ||
[71.426064, "o", "\r\nCorrect!\r\n"] | ||
[71.426176, "o", "Question: 73 * 64\r\nyour answer: "] | ||
[77.765125, "o", "4"] | ||
[78.962237, "o", "6"] | ||
[79.181073, "o", "7"] | ||
[79.458634, "o", "2"] | ||
[80.020703, "o", "\r\n"] | ||
[80.020932, "o", "Correct!\r\nCongatulations, Maria!\r\n"] | ||
[80.025537, "o", "\u001b[?2004h\u001b]0;beril@HOME-PC: ~/python-project-49\u0007\u001b[01;32mberil@HOME-PC\u001b[00m:\u001b[01;34m~/python-project-49\u001b[00m$ "] | ||
[83.75687, "o", "\u001b[?2004l\r\r\nexit\r\n"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import random | ||
import operator | ||
import sys | ||
|
||
OPS = { | ||
'+': operator.add, | ||
'-': operator.sub, | ||
'*': operator.mul, | ||
} | ||
|
||
|
||
def generate_expression(): | ||
num1 = random.randint(1, 100) | ||
num2 = random.randint(1, 100) | ||
op = random.choice(list(OPS.keys())) | ||
expression = f"{num1} {op} {num2}" | ||
result = OPS[op](num1, num2) | ||
return expression, result | ||
|
||
|
||
|
||
def run_game(): | ||
print("Welcome to the Brain Games!") | ||
name = input("May I have your name? ") | ||
print(f"Hello, {name}!") | ||
print("What is the result of the expression?") | ||
|
||
|
||
for i in range(3): | ||
expression, correct_answer = generate_expression() | ||
print(f"Question: {expression}") | ||
try: | ||
user_answer = int(input("your answer: ")) | ||
if user_answer == correct_answer: | ||
print("Correct!") | ||
else: | ||
print(f"'{user_answer}' is wrong answer:(. Correct answer was '{correct_answer}'.") | ||
print(f"Let's try again, {name}!") | ||
return 0 | ||
except ValueError: | ||
print("Invalid input. Please enter an ineger.") | ||
return 0 | ||
print(f"Congatulations, {name}!") | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(run_game()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters