Skip to content

Instantly share code, notes, and snippets.

@Zeptolab18
Zeptolab18 / Кочетков Дмитрий РПО 24.1
Created September 21, 2025 18:21
№1 Домашка по C++ переменные и типы данных
#include <iostream>
#include <cmath>
using namespace std;
// Task 1
// int main() {
// int a, b, S, P;
// cin >> a >> b;
// S = a * b;
// P = 2 * (a + b);
@Zeptolab18
Zeptolab18 / Переменные и типы данных
Created September 21, 2025 09:27
№1 Онлайн практика по C ++
#include <iostream>
#include <cmath>
using namespace std;
// int main() {
// double x1, y1, x2, y2, res;
// cin >> x1 >> y1;
// cin >> x2 >> y2;
// d = sqrt ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
№1
numbers = [1, 3, 5, 7, 2, 4, 6, 8]
new_numbers = []
chet = 0
max_sum = 10
for i in numbers:
if chet + i > max_sum:
print(new_numbers)
new_numbers.clear()
chet = 0
numbers = [67, 43, 15, 0, 3, 4, 2, 1] ; print(f'Оригинальный список {numbers}')
numbers.append(99) ; print(f'Использовали append(99): {numbers}')
numbers.insert(2, 77) ; print(f'Использовали insert(77): {numbers}')
numbers.remove(77) ; print(f'Использовали remove(77): {numbers}')
last_element = numbers.pop() ; print(f'Использовали pop() {numbers}')
numbers1 = [1, 2, 3]
numbers2 = [4, 5, 6]
combined_list = numbers1 + numbers2 ; print(f'Слияние: {numbers1} + {numbers2} = {combined_list}')
copy_list = numbers.copy() ; print(f'Копия списка: {copy_list}')
copy_list.sort() ; print(f'Сортировка sort(): {copy_list}')
'''
size = 9
for i in range(size):
for j in range(size):
print("*", end=" ")
print()
'''
'''
size = 9
for i in range(size):
'''
№6
num = int(input())
s = []
while num > 0:
s.append(num % 10)
num = num // 10
print('Самая большая цифра:', max(s,), end=', ')
print('Самая маленькая цифра:', min(s))
'''
@Zeptolab18
Zeptolab18 / for
Created November 21, 2024 08:05
python
'''
№1
N = int(input("введите число: "))
N += 1
a = 0
for i in range(N):
a += i
print(a)
'''
'''
Задача №1
x = int(input("Введите число: "))
y = 1
while True:
z = x * y
print(x, '*', y, '=', z)
z += 1
if z >= 50:
break
Задача №2
@Zeptolab18
Zeptolab18 / Циклы
Created November 1, 2024 14:05
python
'''
Задача 1
begin = int(input("Введите начало диапазона: "))
end = int(input("Введите конец диапазона: "))
a = 0
while begin <= end:
a += begin
print(a)
begin += 1
'''
'''
Задание №1
n = int(input("Введите число: "))
if n % 2 == 0:
print("Число четное")
if n % 5 == 0:
print("Число кратно пяти")
if n % 2 != 0 and n % 5 != 0:
print("Число не четное и не кратно пяти")
'''