Conversation
luchanos
reviewed
Dec 18, 2020
|
|
||
| import sys | ||
| try: | ||
| print(int(sys.argv[1])*int(sys.argv[2])+int(sys.argv[3])) |
| 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]] |
| # Для чисел в пределах от 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 |
| list.append(a) | ||
| i+=1 | ||
| print(f"Initial list:\n{list}") | ||
| new_list = [b for b in list if list.count(b) == 1] |
| def multiplier (el1, el2): | ||
| return el1*el2 | ||
|
|
||
| # hellofromhell = reduce(multiplier, list) |
|
|
||
| from functools import reduce | ||
|
|
||
| list=[el for el in range(100,1001,2)] |
|
|
||
| def listgen(start, end): | ||
| print("Вот сгенерированный лист:") | ||
| global list |
Owner
Author
There was a problem hiding this comment.
Это рудимент, сначала обращался к листу вне функции, потом забыл удалить)
| i = 0 | ||
| print("А вот повторение этого листа столько раз, сколько в нем элементов:") | ||
| while i < (len(list) * len(list)): | ||
| print(next(cycler)) |
| def fact(n): | ||
| factorial = 1 | ||
| for i in range(1, n + 1): | ||
| factorial *= i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.