Skip to content

ДЗ-1 #126

Open
Ammatar wants to merge 21 commits into
GeekBrainsTutorial:masterfrom
Ammatar:master
Open

ДЗ-1 #126
Ammatar wants to merge 21 commits into
GeekBrainsTutorial:masterfrom
Ammatar:master

Conversation

@Ammatar

@Ammatar Ammatar commented Sep 6, 2018

Copy link
Copy Markdown

No description provided.


a = [1,2,3,4,5,6,7,8,9]
b = [2,3,4,10]
try: b1 = map(a.remove, b)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

hard way :D

pass
ticket_number_map = list(map(int, str(ticket_number)))
try:
ticket_part_1 = ticket_number_map[0] + ticket_number_map[1] + ticket_number_map[2]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Поговорим про exception'ы сегодня. Нельзя их так использовать

a = 0
fibo = [1, 1]
while a< m:
fibo.append(fibo[0+a]+fibo[1+a])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

хорошо. но когда делаешь a += 1 лучше исопльзовать цикл for, который это делает автоматом - для избежания ошибок и понятнее)

# Разумеется, внутри нельзя использовать саму функцию filter.

def myFilter(listed, x):
listed_res = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут имелось в виду передать функцию filter(lambda x: x == 0, [1, 2, 3]) например


first_list = ['orange','apple', 'ananas', 'pears', 'banana']
second_list = ['orange', 'banana','apple', 'ananas']
result_list = [i for i in first_list and second_list]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Это работает непраивльно

>>> a = [1, 2, 0]
>>> b = [1, 2, 3]
>>> [i for i in a and b]
[1, 2, 3]

'zTYwZAiRwycdlHfyHNGmkNqSwXUrxGc'

import re
split_line = re.split(r'[A-Z]', line)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Тут у вас на выходе будет много пустых элементов. Разбирали на вебинаре, посмотри)

while number < 10:
os.mkdir('./dir_'+str(number), mode=511, dir_fd=None)
number += 1
time.sleep(10)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

зачем тут sleep? директория не успевает создаться?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

успевает, вставлял sleep для теста (нагляднее), забыл закоментить при сдаче :)

# и импортированные в данный файл из easy.py

# немного не успел доделать
import hw05_easy_func, os

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

прикольно) но лучше импортами в одну строчку не увлекаться для читабельности. Здесь к месту, хорошо)

def height(self):
pass

ttriangle = Triangle(1,5,5,7,5,2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не забываем выносить в main, что не привязано к классам. Потому что обычно модули с классами импортятся

self.teachers.append(teacher)

def add_teacher_lesson(self, lesson):
self.lessons.append(lesson)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

тут можно было добавить логику, что один предмет ведётся одним преподавателем

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants