-
Notifications
You must be signed in to change notification settings - Fork 51
ready to review #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
ready to review #48
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| """ | ||
| Підрахувати кількість порожніх листів | ||
| """ | ||
| rand_list = ["asdasd", 1231, 1251.1001, [], [123, 123, "ASD"], "KSAJFKJO1", "1234124", [123, 321], [], [], 123, 123.123, [], [123]] | ||
| counter = 0 | ||
| for element in rand_list: | ||
| if isinstance(element, list) is True and len(element) == 0: | ||
| counter += 1 | ||
| print("Count of empty lists: ", counter) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| """ | ||
| Вивести усі слова, що містять цифру 9 | ||
| """ | ||
| rand_text = "Adp9slp spldpsldpsl sdlpsldp sa9d aspdl as asldp asdpl asdlp a a9 a apsdl asd asdsap asd asdqwe qwe qweqw9rtfas qwrqawsfqwfxaf qpwl9dpsa" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Зроблено за допомогою функцій def if_word_9(text): |
||
| rand_list = rand_text.split() | ||
| result_str = "" | ||
| for word in rand_list: | ||
| counter = False | ||
| for letter in word: | ||
| if letter == "9": | ||
| counter = True | ||
| if counter is True: | ||
| result_str += word + " " | ||
| # print(word, end=" ") | ||
| else: | ||
| continue | ||
| print(result_str) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| """ | ||
| Користувач вводить два дійсних числа. Вивести всі числа кратні 3 на цьому проміжку. | ||
| """ | ||
| first_num = float(input("Enter the first number:")) | ||
| second_num = float(input("Enter the second number:")) | ||
|
|
||
| for num in range(int(first_num), int(second_num)+1): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Зроблено за допомогою функцій def numb(start,end): print(numb(first_num,second_num)) ` |
||
| if num % 3 == 0: | ||
| print(num) | ||
| else: | ||
| continue | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import re | ||
|
|
||
| """ | ||
| Користувач вводить дату, визначити який день тижня припадає на цю дату. При урахуванні того, що 01.01.0001 припадає на понеділок | ||
| """ | ||
|
|
||
| def is_date(start_str): | ||
| return bool(re.match(r"^[1-30][1-90]-[01][1-90]-\d{4}$", start_str)) | ||
|
|
||
| def date_validator(text=""): | ||
| result_str = input(text) | ||
| while not is_date(result_str): | ||
| result_str = input("Некоректно введено дату, введіть знову: ") | ||
| return result_str | ||
|
|
||
| def day_counter(user_list): | ||
| day_list = ["Понедельник","Вторник","Среда","Четверг","Пятница","Суббота","Воскресенье"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Дні тижня слід писати українською мовою |
||
| sum_of_days = (int(user_list[2])*365) + (int(user_list[1])*31) + int(user_list[0]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Не вистачає обробки високосного року. ` |
||
|
|
||
| return day_list[(sum_of_days%7)-1] | ||
|
|
||
| print("Доброго дня. Введіть дату у форматі 31-12-0001: ") | ||
| user_date = date_validator() | ||
| user_date = re.split(r"-", user_date) | ||
| # print(user_date) | ||
| result_day = day_counter(user_date) # func day | ||
| print(result_day) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зроблено за допомогою функцій
`
def empty_lists(list_1):
counter = 0
for element in list_1:
if isinstance(element, list) is True and len(element) == 0:
counter += 1
return int(counter)
print("Count of empty lists: ", empty_lists(rand_list))
`