Skip to content

Homework4#4

Open
facelli wants to merge 5 commits into
mainfrom
homework4
Open

Homework4#4
facelli wants to merge 5 commits into
mainfrom
homework4

Conversation

@facelli

@facelli facelli commented Dec 15, 2020

Copy link
Copy Markdown
Owner

No description provided.


import sys
try:
print(int(sys.argv[1])*int(sys.argv[2])+int(sys.argv[3]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+++

list.append(a)
i+=1
print(f"Generated list:\n{list}")
mod_list = [list[item] for item in range(1, len(list)) if list[item] > list[item - 1]]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+++

Comment thread fourth lesson/3-d_task.py
# Для чисел в пределах от 20 до 240 найти числа, кратные 20 или 21. Необходимо решить задание в одну строку.
# Подсказка: использовать функцию range() и генератор.

print([a for a in range(20, 241) if a % 20 == 0 or a % 21 == 0]) # в одну строку %) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+++

list.append(a)
i+=1
print(f"Initial list:\n{list}")
new_list = [b for b in list if list.count(b) == 1]

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 multiplier (el1, el2):
return el1*el2

# hellofromhell = reduce(multiplier, 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.

хаха))


from functools import reduce

list=[el for el in range(100,1001,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.

++


def listgen(start, end):
print("Вот сгенерированный лист:")
global 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.

зачем глобал? это тут лишнее

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Это рудимент, сначала обращался к листу вне функции, потом забыл удалить)

i = 0
print("А вот повторение этого листа столько раз, сколько в нем элементов:")
while i < (len(list) * len(list)):
print(next(cycler))

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 fact(n):
factorial = 1
for i in range(1, n + 1):
factorial *= i

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