make folders

This commit is contained in:
Yesenya 2023-11-09 13:28:19 +03:00
parent ff2d231d78
commit c48a0993a9
7 changed files with 246 additions and 0 deletions

10
task1/task1.py Normal file
View File

@ -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()

84
task3/report.json Normal file
View File

@ -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"
}
]
}
]
}

26
task3/task3.py Normal file
View File

@ -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')

63
task3/tests.json Normal file
View File

@ -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": ""
}]
}]
}

39
task3/values.json Normal file
View File

@ -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"
}]
}

4
task4/file.txt Normal file
View File

@ -0,0 +1,4 @@
1
10
2
9

20
task4/task4.py Normal file
View File

@ -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)