НА ПИТОНЕ Введите 3 числа с клавиатуры. Первое число увеличите на 3. Второе уменьшите в 2 раза. Третье число возведите в куб. Найдите сумму новых чисел.
mas[i]:= random(100); {Заполняем массив случайными числами в промежетке от 0 до 99 (можешь изменить промежуток}
write(mas[i],' ');
end;
Writeln('Введите a,b');
Readln(a,b);
For i:=1 To 20 Do
begin if (mas[i]>a) and (mas[i]<b) Then sum:=sum+mas[i]; end; Writeln(sum); end. 2) Program massiv; Var mas:array[1..20] of integer; i,min,max,pr:integer; Begin For i:=1 To 20 Do begin mas[i]:= random(15); write(mas[i],' '); end; Writeln; min:=30000; max:=0; For i:=1 To 15 Do begin if mas[i]>max Then max:=mas[i]; if mas[i]<min Then min:=mas[i]; end; pr:=min*max; Writeln(pr); end. 3)Program massiv;Var mas:array[1..20] of integer; a,b,i,k:integer;BeginFor i:=1 To 20 Dobegin mas[i]:= random(100); {Заполняем массив случайными числами в промежетке от 0 до 99 (можешь изменить промежуток}write(mas[i],' ');end;Writeln('Введите a,b,k');Readln(a,b,k);i:=1;While i<>20 Dobeginif (mas[i]>a) and (mas[i]<b) and(mas[i] mod k=0) ThenWrite(mas[i],' ');i:=i+1;end; end. 4)Var mas:array[1..20] of integer; i,min,max,pr:integer; Begin randomize; For i:=1 To 20 Do begin mas[i]:= random(100)+1; write(mas[i],' '); end; Writeln; pr:=1; For i:=1 To 15 Do begin pr:=pr*mas[i]; end; Writeln(pr); end.
Var mas:array[1..20] of integer;
a,b,i,sum:integer;
Beginsum:=0;
For i:=1 To 20 Do
beginmas[i]:= random(100); {Заполняем массив случайными числами в промежетке от 0 до 99 (можешь изменить промежуток}
write(mas[i],' ');
end;Writeln('Введите a,b');
Readln(a,b);For i:=1 To 20 Do
begin if (mas[i]>a) and (mas[i]<b) Then sum:=sum+mas[i]; end; Writeln(sum); end. 2) Program massiv; Var mas:array[1..20] of integer; i,min,max,pr:integer; Begin For i:=1 To 20 Do begin mas[i]:= random(15); write(mas[i],' '); end; Writeln; min:=30000; max:=0; For i:=1 To 15 Do begin if mas[i]>max Then max:=mas[i]; if mas[i]<min Then min:=mas[i]; end; pr:=min*max; Writeln(pr); end. 3)Program massiv;Var mas:array[1..20] of integer; a,b,i,k:integer;BeginFor i:=1 To 20 Dobegin mas[i]:= random(100); {Заполняем массив случайными числами в промежетке от 0 до 99 (можешь изменить промежуток}write(mas[i],' ');end;Writeln('Введите a,b,k');Readln(a,b,k);i:=1;While i<>20 Dobeginif (mas[i]>a) and (mas[i]<b) and(mas[i] mod k=0) ThenWrite(mas[i],' ');i:=i+1;end; end. 4)Var mas:array[1..20] of integer; i,min,max,pr:integer; Begin randomize; For i:=1 To 20 Do begin mas[i]:= random(100)+1; write(mas[i],' '); end; Writeln; pr:=1; For i:=1 To 15 Do begin pr:=pr*mas[i]; end; Writeln(pr); end.import json
class Person:
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender
def to_dict(self):
return {"name": self.name, "age": self.age, "gender": self.gender}
class Teacher(Person):
def __init__(self, name, age, gender, subject):
super().__init__(name, age, gender)
self.subject = subject
def to_dict(self):
teacher_dict = super().to_dict()
teacher_dict["subject"] = self.subject
return teacher_dict
class Student(Person):
def __init__(self, name, age, gender, group):
super().__init__(name, age, gender)
self.group = group
def to_dict(self):
student_dict = super().to_dict()
student_dict["group"] = self.group
return student_dict
class Test:
def __init__(self, questions, answers):
self.questions = questions
self.answers = answers
def run(self):
score = 0
for i, question in enumerate(self.questions):
print(f"Question {i + 1}: {question}")
answer = input("Enter your answer: ")
if answer == self.answers[i]:
score += 1
print(f"Your score: {score}/{len(self.questions)}")
return score
def to_dict(self):
return {"questions": self.questions, "answers": self.answers}
class TestResult:
def __init__(self, student_name, test, score):
self.student_name = student_name
self.test = test
self.score = score
def to_dict(self):
return {"student_name": self.student_name, "test": self.test.to_dict(), "score": self.score}
class Database:
def __init__(self, teachers_file, students_file, test_results_file):
self.teachers_file = teachers_file
self.students_file = students_file
self.test_results_file = test_results_file
def load_file(self, file_path):
try:
with open(file_path, "r") as f:
return json.load(f)
except FileNotFoundError:
return []
def save_file(self, data, file_path):
with open(file_path, "w") as f:
json.dump(data, f)
def add_teacher(self, teacher):
teachers = self.load_file(self.teachers_file)
teachers.append(teacher.to_dict())
self.save_file(teachers, self.teachers_file)
def get_teachers(self):
return [Teacher(**teacher_dict) for teacher_dict in self.load_file(self.teachers_file)]
def add_student(self, student):
students = self.load_file(self.students_file)
students.append(student.to_dict())
self.save_file(students, self.students_file)
def get_students(self):
return [Student(**student_dict) for student_dict in self.load_file(self.students_file)]
def add_test_result(self, test_result):
test_results = self.load_file(self.test_results_file)
test_results.append(test_result.to_dict())
self.save_file(test_results, self.test_results_file)
def get_test_results(self):
test_results = self.load_file(self.test_results_file)
return [TestResult(test_result["student_name"], Test(**test_result["test"]), test_result["score"]) for test_result in test_results]