added many files

This commit is contained in:
ada-dmitry
2024-02-29 15:12:40 +03:00
parent 5a686b0f92
commit 09c84971a9
11 changed files with 101 additions and 1 deletions
+26
View File
@@ -0,0 +1,26 @@
import json
import unittest
def input_digit():
try:
with open('answer.json') as f:
x = json.load(f)
print(f'Ваше любимое число: {x}')
except FileNotFoundError:
x = int(input('Введите ваше любимое число: '))
with open('answer.json', 'w') as f:
json.dump(x, f)
def output_digit():
with open('answer.json') as f:
x = json.load(f)
print(f'Ваше любимое число: {x}')
input_digit()
output_digit()
class InputTest(unittest.TestCase):
'''Тесты для функции ввода с клавиатуры'''
def test_