Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1791dff
добавил файл
moisdima Sep 13, 2022
8c7b946
добавил файл
moisdima Sep 15, 2022
c63abad
добавил файл
moisdima Sep 15, 2022
92b81d6
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Sep 15, 2022
71db7a3
добавил файл
moisdima Sep 15, 2022
797129d
вынез переменную s из while
moisdima Sep 16, 2022
1ddcaee
добавил файл
moisdima Sep 16, 2022
32dfe88
добавил файл
moisdima Sep 16, 2022
9eeea1e
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Sep 16, 2022
4fbd336
добавил файл
moisdima Sep 16, 2022
4be8562
добавил файл
moisdima Sep 17, 2022
54c0be5
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Sep 19, 2022
2ff347e
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Sep 26, 2022
3cc087a
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Sep 28, 2022
0c177ac
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Sep 28, 2022
1515497
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Sep 29, 2022
44a86f6
добавил файл
moisdima Sep 30, 2022
fbfd5d4
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Oct 3, 2022
22126d8
исправил
moisdima Oct 5, 2022
bc9a709
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Oct 5, 2022
0b6924f
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Oct 6, 2022
37a46b2
исправил
moisdima Oct 6, 2022
4d3f243
добавил файлы
moisdima Oct 7, 2022
306c941
исправил
moisdima Oct 9, 2022
0bb52f0
исправил
moisdima Oct 11, 2022
0472c37
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Oct 13, 2022
6316397
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Oct 17, 2022
162b293
добавил файл
moisdima Oct 19, 2022
0cbee17
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Oct 19, 2022
7f3c4b3
Merge branch 'main' of https://github.com/IlyaOrlov/PythonCourse2.0_A…
moisdima Oct 23, 2022
0240b0d
добавил файл
moisdima Oct 23, 2022
5f18ada
добавил файл
moisdima Oct 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Practice/MoiseevD/lesson_4_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
i = 0
while i < 100:
i += 1
if i % 15 == 0:
print('FizzBizz')
elif i % 5 == 0:
print('Bizz')
elif i % 3 == 0:
print('Fizz')
else:
print(i)
5 changes: 5 additions & 0 deletions Practice/MoiseevD/lesson_4_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
s = input('Введите пятизначное число: ')
i = 0
while i < len(s):
i += 1
print(f'{i} Цифра равна: {s[i-1]}')
14 changes: 14 additions & 0 deletions Practice/MoiseevD/lesson_4_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
str_num = ""

while True:
s = input('Введите число, для выхода введите "stop" : ')

if s.lower() == 'stop':
break

if not s.isdecimal():
print('--Введите только число--')
continue

str_num += s
print(str_num)
14 changes: 14 additions & 0 deletions Practice/MoiseevD/lesson_4_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import random


s = ('Ты сам-то понял, что написал?', 'Аргументируй', 'И?')

while True:
question = input('Задайте вопрос: ')

if question.lower() == 'хватит':
print('---Выход из программы---')
break
else:
answers = random.choice(s)
print(answers)
20 changes: 20 additions & 0 deletions Practice/MoiseevD/lesson_4_5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import random


s = int(input('Введите нижний диапазон: '))
s1 = int(input('Введите верхний диапазон: '))
num = random.randint(s, s1)

while True:
guess_str = input('Угадайте число: ')
if not guess_str.isdecimal():
print('---Завершение---')
break
guess = int(guess_str)
if guess == num:
print('---Вы угадали---')
break
elif guess < num:
print(' Ваше число меньше ')
elif guess > num:
print(' Ваше число больше ')
13 changes: 13 additions & 0 deletions Practice/MoiseevD/lesson_4_6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def max_item(a, b):
print(max(a, b))


def max_ret(a, b):
return max(a, b)


high = int(input('Введите первое число: '))
low = int(input('Введите второе число: '))
max_item(high, low)
b = max_ret(high, low)
print(b)
16 changes: 16 additions & 0 deletions Practice/MoiseevD/lesson_4_7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def decor_start(start):
Comment thread
IlyaOrlov marked this conversation as resolved.
def decor_finish(*args, **kwargs):
print("=====1======")
res = start(*args, **kwargs)
print("=====2======")
return res
return decor_finish


@decor_start
def start_finish(start):
print(start)


start_finish('=================')

32 changes: 32 additions & 0 deletions Practice/MoiseevD/lesson_4_8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import random


game_list = ("камень", "ножницы", "бумага")

while True:
game = random.choice(game_list)
s = input('Введите слово "КАМЕНЬ", "НОЖНИЦЫ", или "БУМАГА": ')
s = s.lower()
if s == 'камень':
if game == game_list[0]:
print(f'---{game}---\n Ничья')
elif game == game_list[1]:
print(f'---{game}---\n Вы выиграли')
else:
print(f'---{game}---\n Вы проиграли')

elif s == 'ножницы':
if game == game_list[0]:
print(f'---{game}---\n Вы проиграли')
elif game == game_list[1]:
print(f'---{game}---\n Ничья')
else:
print(f'---{game}---\n Вы выиграли')

elif s.lower() == 'бумага':
if game == game_list[0]:
print(f'---{game}---\n Вы выиграли')
elif game == game_list[1]:
print(f'---{game}---\n Вы проиграли')
else:
print(f'---{game}---\n Ничья')
25 changes: 25 additions & 0 deletions Practice/MoiseevD/lesson_5_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
def current_index(arr, idx):
idx_min = idx
i = idx
# while i < len(arr):
# if arr[i] < arr[idx_min]:
# idx_min = i
# i += 1
for i in range(idx, len(arr)):
if arr[i] < arr[idx_min]:
idx_min = i
i += 1
return idx_min


def min_element(elm):
for i in range(len(elm)):
cur_idx = current_index(elm, i)
if cur_idx != i:
elm[cur_idx], elm[i] = elm[i], elm[cur_idx]
return elm


a = [0, 3, 24, 2, 3, 7]
res = min_element(a)
print(res)
31 changes: 31 additions & 0 deletions Practice/MoiseevD/lesson_6_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class Tank:
def __init__(self, power, model):
self.power = power
self.model = model

class T34(Tank):
def shoot(self):
print(self.model, ' - Бах')

class Tiger(Tank):
def shoot(self):
print(self.model, ' - Ба-бах')

class Abrams(Tank):
def shoot(self):
print(self.model, ' - Ба-ба-бах')

while True:
t = input('Введите одну из мощностей выстрела: 30 - 80 - 90 ')
if t.lower() == 'stop':
print('Выход из программы')
break
elif t == '30':
tnk1 = T34(30, 'T34')
tnk1.shoot()
elif t == '80':
tnk2 = Tiger(80, 'Tiger')
tnk2.shoot()
elif t == '90':
tnk3 = Abrams(90, 'Abrams')
tnk3.shoot()
44 changes: 44 additions & 0 deletions Practice/MoiseevD/lesson_6_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class Duck:
def __init__(self, name, weight, collor):
self._name = name
self._weight = weight
self._collor = collor

def name_weight(self):
print('Имя:', self._name, ' Вес:', self._weight, 'кг')

def __repr__(self):
return f'class Duck: name = {self._name} weight = {self._weight} collor = {self._collor}'

def __lt__(self, other):
if self._weight < other._weight:
return other._name
else:
return self._name

def __ne__(self, other):
return self._weight != other._weight

def __add__(self, other):
return self._weight + other._weight
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отступов многовато.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет. И в других методах стало так же (8 пробелов, а должно быть 4). Возможно, проблема с табуляцией.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет. Ничего не исправилось (см. вкладку Files changed - https://github.com/IlyaOrlov/PythonCourse2.0_August22/pull/69/files)


@classmethod
def collor_duck(cls, collor):
print(cls, collor)

@staticmethod
def crack_duck():
print('Crack')


p = Duck('Гага', 4, 'белый',)
p1 = Duck('КряКря', 7, 'черный',)

p.crack_duck()
p.collor_duck('черный')
p.name_weight()
print(repr(p))
print(repr(p1))
print('Самая тяжелая утка: ', p < p1)
print('Вес уток не равен: ', p != p1)
print('Общий вес уток: ', p + p1)
10 changes: 10 additions & 0 deletions Practice/MoiseevD/lesson_7_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Man:
def __init__(self, name):
self._name = name

def solve_task(self):
print("I'm not ready yet")


res = Man('Дмитрий')
res.solve_task()
21 changes: 21 additions & 0 deletions Practice/MoiseevD/lesson_7_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import time
import random


class Pupil:
def __init__(self, name):
self._name = name

def solve_task(self):
print("I'm not ready yet")


class Tim(Pupil):
def solve_task(self):
n = random.randint(3, 6)
time.sleep(n)
super().solve_task()


res = Tim('Дмитрий')
res.solve_task()
48 changes: 48 additions & 0 deletions Practice/MoiseevD/lesson_7_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
class Bank:
def __init__(self, cash):
self._cash = cash


class Bankomat1(Bank):
def input_output(self):
while True:
inp = input('Внести деньги - введите "1". Для снятия - "2" ')
if inp.lower() == '1':
inp = int(input('Положите купюры в лоток: '))
self._cash += inp
elif inp.lower() == '2':
out = int(input('Введите требуемую сумму: '))
if self._cash < out:
print('=== Не достаточно денег в банкомате ===')
continue
self._cash -= out
else:
print('----- Неправильный ввод.-----\n '
'Для выхода введите: EXIT \n'
'Для продолжения операции введите любой знак: ')
stop = input('---- ')
if stop.lower() == 'exit':
print('Выход')
break
continue
print(f'Оставшаяся наличность в Bankomat1 : {self._cash}')


class Bankomat2(Bank):
def exchange(self):
print(f'Оставшаяся наличность в Bankomat2: {self._cash}')


class Bankomat3(Bank):
def transfer(self):
print(f'Оставшаяся наличность в Bankomat3: {self._cash}')


#lst = Bank(1000)
lst1 = Bankomat1(500)
lst2 = Bankomat2(1500)
lst3 = Bankomat3(3000)

lst1.input_output()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А как узнать, какие операции поддерживает тот или иной банкомат?

lst2.exchange()
lst3.transfer()
19 changes: 19 additions & 0 deletions Practice/MoiseevD/lesson_8_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import time


class timeManager:

def __enter__(self):
self.t1 = time.time()
print(f'Запуск таймера в менеджере контекста {self.t1}')

def __exit__(self, exc_type, exc_val, exc_tb):
self.t2 = time.time() - self.t1
print('Остановка таймера менеджера контекста')
print(f'Время исполнения кода {self.t2}')


lst =range(2, 100000)
with timeManager():
for i in lst:
print(i)
1 change: 1 addition & 0 deletions Practice/MoiseevD/read_8_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Реализовать итератор, который бы "читал" заданный текст по параграфам. &Символ параграфа задается отдельно.
3 changes: 3 additions & 0 deletions Practice/MoiseevD/read_8_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Привет!
Добро пожаловать на Python.
Удачи в обучении!