Skip to content

Instantly share code, notes, and snippets.

@gmakc-094423
gmakc-094423 / Задача 1
Created September 21, 2022 20:36
Домашнее задание к 4 семинару
public class Stack<T> {
private T[] array;
private int index;
public Stack(int length) {
this.index = 0;
this.array = (T[]) new Object[length];
}
public int size() {
@gmakc-094423
gmakc-094423 / Задача 1
Created September 18, 2022 14:20
Домашнее задание к семинару 3
package dz_03;
import java.util.ArrayList;
import java.util.Collections;
public class dz_03_01 {
public static void main(String[] args) {
ArrayList<Integer> numList = new ArrayList<Integer>();
Collections.addAll(numList, 1, 3, 6, 3, 8, 2, 5, 8, 77, 12, 76, 22, 2, 67);
@gmakc-094423
gmakc-094423 / Задача 1
Created September 14, 2022 21:25
Домашнее задание к 2 семинару
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class dz_02_1 {
public static void main(String[] args) throws IOException {
// Path dir = Path.of("C:\\Program Files\\Java\\jdk-11.0.16\\conf\\management",
@gmakc-094423
gmakc-094423 / Задача 1
Created September 7, 2022 21:08
Домашнее задание к 1 семинару
public class dz_01 {
static int sum(int[] arr, int start, int end) {
int sum = 0;
for (int i = start; i < end; i++) {
sum += arr[i];
}
return sum;
}
@gmakc-094423
gmakc-094423 / Задача 1
Created August 1, 2022 16:22
Домашнее задание к семинару № 6
import random
def print_matrix(matrix):
for i in range(0, len(matrix)):
for i2 in range(0, len(matrix[i])):
print(matrix[i][i2], end=" ")
print()
@gmakc-094423
gmakc-094423 / Задача 1
Created August 1, 2022 16:19
Домашнее задание к семинару № 5
import re
def read_file(file_name):
path = file_name
f = open(path, "r")
result = f.read().replace(" ", "")
f.close()
return result
@gmakc-094423
gmakc-094423 / Задача 1
Created July 25, 2022 16:07
Домашнее задание к семинару № 4
def InputNumbers(inputText):
is_OK = False
while not is_OK:
try:
number = float(input(f"{inputText}"))
is_OK = True
except ValueError:
print("Какое-то неправильное число!")
return number
@gmakc-094423
gmakc-094423 / Задача 1
Created July 20, 2022 16:01
Домашнее задание к семинару № 3
from random import randint
def InputNumbers(inputText):
is_OK = False
while not is_OK:
try:
number = int(input(f"{inputText}"))
is_OK = True
except ValueError:
@gmakc-094423
gmakc-094423 / Задача 1
Created July 18, 2022 00:20
Домашнее задание ко 2 семинару
""" Напишите программу, которая принимает на вход вещественное число и показывает сумму его цифр.
Пример:
- 6782 -> 23
- 0,56 -> 11 """
def InputNumbers(inputText):
is_OK = False
while not is_OK:
try:
@gmakc-094423
gmakc-094423 / Задача 1
Created July 9, 2022 23:25
Решение задач к семинару № 1 (Знакомство с языком Python)
""" Напишите программу, которая принимает на вход цифру, обозначающую день недели, и проверяет, является ли этот день выходным.
Пример: - 6 -> да - 7 -> да - 1 -> нет """
def InputNumbers(inputText):
is_OK = False
while not is_OK:
try:
number = int(input(f"{inputText}"))
is_OK = True