diff --git a/task1/task1.py b/task1/task1.py new file mode 100644 index 0000000..9c6fb04 --- /dev/null +++ b/task1/task1.py @@ -0,0 +1,10 @@ +import sys +n = int(sys.argv[1]) +m = int(sys.argv[2]) +st = 1 +while True: + print(st, end='') + st = 1+(st+m-2)%n + if st == 1: + break +print() \ No newline at end of file diff --git a/task3/report.json b/task3/report.json new file mode 100644 index 0000000..6a5fca7 --- /dev/null +++ b/task3/report.json @@ -0,0 +1,84 @@ +{ + "tests": [ + { + "id": 2, + "title": "Smoke test", + "value": "passed" + }, + { + "id": 41, + "title": "Debug test", + "value": "passed" + }, + { + "id": 73, + "title": "Performance test", + "value": "passed", + "values": [ + { + "id": 345, + "title": "Maxperf", + "value": "passed", + "values": [ + { + "id": 230, + "title": "Percent", + "values": [ + { + "id": 234, + "title": "200", + "value": "passed" + }, + { + "id": 653, + "title": "300", + "value": "passed" + } + ] + } + ] + }, + { + "id": 110, + "title": "Stability test", + "value": "failed", + "values": [ + { + "id": 261, + "title": "Percent", + "values": [ + { + "id": 238, + "title": "160", + "value": "passed" + }, + { + "id": 690, + "title": "240", + "value": "failed" + } + ] + } + ] + } + ] + }, + { + "id": 122, + "title": "Security test", + "value": "failed", + "values": [ + { + "id": 5321, + "title": "Confidentiality", + "value": "passed" + }, + { + "id": 5322, + "title": "Integrity", + "value": "failed" + } + ] + } + ] +} \ No newline at end of file diff --git a/task3/task3.py b/task3/task3.py new file mode 100644 index 0000000..f4c9a11 --- /dev/null +++ b/task3/task3.py @@ -0,0 +1,26 @@ +import sys +import json +import shutil + +file1 = "task3/" + sys.argv[1] +file2 = "task3/" + sys.argv[2] + +with open(file1, 'r') as file: + tests_data = json.load(file) + +with open(file2, 'r') as file: + values_data = json.load(file) + +def update_tests(tests, values): + for test in tests: + for value in values: + if value['id'] == test['id']: + test['value'] = value['value'] + if 'values' in test: + update_tests(test['values'], values) + +update_tests(tests_data['tests'], values_data['values']) + +with open('report.json', 'w') as file: + json.dump(tests_data, file, indent=4) +shutil.move('report.json', 'task3/report.json') \ No newline at end of file diff --git a/task3/tests.json b/task3/tests.json new file mode 100644 index 0000000..65e3408 --- /dev/null +++ b/task3/tests.json @@ -0,0 +1,63 @@ +{ + "tests": [{ + "id": 2, + "title": "Smoke test", + "value": "" + }, { + "id": 41, + "title": "Debug test", + "value": "" + }, { + "id": 73, + "title": "Performance test", + "value": "", + "values": [{ + "id": 345, + "title": "Maxperf", + "value": "", + "values": [ { + "id": 230, + "title": "Percent", + "values": [{ + "id": 234, + "title": "200", + "value": "" + }, { + "id": 653, + "title": "300", + "value": "" + }] + }] + }, { + "id": 110, + "title": "Stability test", + "value": "", + "values": [ { + "id": 261, + "title": "Percent", + "values": [{ + "id": 238, + "title": "160", + "value": "" + }, { + "id": 690, + "title": "240", + "value": "" + }] + }] + }] + }, { + "id": 122, + "title": "Security test", + "value": "", + "values": [{ + "id": 5321, + "title": "Confidentiality", + "value": "" + }, { + "id": 5322, + "title": "Integrity", + "value": "" + }] + }] +} \ No newline at end of file diff --git a/task3/values.json b/task3/values.json new file mode 100644 index 0000000..c13a13d --- /dev/null +++ b/task3/values.json @@ -0,0 +1,39 @@ +{ + "values": [{ + "id": 2, + "value": "passed" + }, { + "id": 41, + "value": "passed" + }, { + "id": 73, + "value": "passed" + }, { + "id": 110, + "value": "failed" + }, { + "id": 122, + "value": "failed" + }, { + "id": 234, + "value": "passed" + }, { + "id": 238, + "value": "passed" + }, { + "id": 345, + "value": "passed" + }, { + "id": 653, + "value": "passed" + }, { + "id": 690, + "value": "failed" + }, { + "id": 5321, + "value": "passed" + }, { + "id": 5322, + "value": "failed" + }] +} \ No newline at end of file diff --git a/task4/file.txt b/task4/file.txt new file mode 100644 index 0000000..b1ecef9 --- /dev/null +++ b/task4/file.txt @@ -0,0 +1,4 @@ +1 +10 +2 +9 \ No newline at end of file diff --git a/task4/task4.py b/task4/task4.py new file mode 100644 index 0000000..9822fc0 --- /dev/null +++ b/task4/task4.py @@ -0,0 +1,20 @@ +import sys +a = sys.argv[1] +nums = [] +with open (a, "r") as b: + nums = [int(line) for line in b] +sum = 0 +step = 0 +for num in nums: + sum+= num +avg_num_r = round(sum/ len(nums)) +for num in nums: + while num != avg_num_r: + if num > avg_num_r: + num -= 1 + step += 1 + elif num < avg_num_r: + num += 1 + step +=1 +print(step) + \ No newline at end of file