mirror of
https://github.com/ada-dmitry/python_ada.git
synced 2026-09-24 01:10:25 +00:00
added many files
This commit is contained in:
@@ -0,0 +1 @@
|
||||
5
|
||||
@@ -0,0 +1,17 @@
|
||||
import unittest
|
||||
|
||||
def fact(x):
|
||||
if(x==1):
|
||||
return 1
|
||||
else:
|
||||
return x*fact(x-1)
|
||||
|
||||
class FactTest(unittest.TestCase):
|
||||
'''Проверка функции факториала'''
|
||||
|
||||
def test_5_fact(self):
|
||||
ans = fact(5)
|
||||
self.assertEqual(ans, 120)
|
||||
|
||||
|
||||
unittest.main()
|
||||
@@ -0,0 +1 @@
|
||||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
@@ -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_
|
||||
Reference in New Issue
Block a user