-
Notifications
You must be signed in to change notification settings - Fork 50
ready_to_review #49
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 #49
Changes from all commits
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,5 @@ | ||
| ''' | ||
| Вивести кількість порожніх списків | ||
| ''' | ||
| a = [1, 3, 'a', 123, [], 'hello', []] | ||
| print('Кількість порожніх списків:', a.count([])) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| ''' | ||
| Вивести з тексту слова з великої літери | ||
| ''' | ||
| text = str(input('Введіть рядок:')) | ||
| list = [] | ||
| text =text.split(" ") | ||
| for word in text: | ||
| if (i.isupper() for i in word): | ||
| list.append(word) | ||
| print(list) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| ''' | ||
| Вивести суму усіх елементів списку, що являють собою числа, та окремо вивести рядочок, який складається з усіх рядочків | ||
| ''' | ||
| list = [2, 8, 'w', 'j', []] | ||
| sum = 0 | ||
| q = '' | ||
| for i in range(len(list)): | ||
| if isinstance(list[i], int): | ||
| sum = sum + list[i] | ||
| elif isinstance(list[i], str): | ||
| q = q + list[i] +' ' | ||
|
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. delete this: |
||
| else: | ||
| print('Кінець') | ||
|
Comment on lines
+12
to
+13
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. delete this |
||
| print('Сума:', sum) | ||
| print('Конкатенація:', q) | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| ''' | ||
| Користувач вводить час у форматі `hh:mm(:ss(.ms))`, де дужки позначають необов'язковість. | ||
| Напишіть функцію, що повертає кількість повних секунд, що пройшли з опівночі. | ||
| Виведіть результат. | ||
| У випадку помилкового вводу виведіть повідомлення про помилку. | ||
| ''' | ||
|
|
||
| import re | ||
| re_form = re.compile(r'/d/d') | ||
|
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. change this: |
||
| def validator(pattern, promt): | ||
| text = input(promt) | ||
| while not bool(pattern.match(text)): | ||
| text = input(promt) | ||
| return text | ||
|
|
||
| hours = int(validator(re_form ,'Введіть години hh:')) | ||
| min = int(validator(re_form ,'Введіть хвилини mm:')) | ||
| sec = int(validator(re_form ,'Введіть секунди(необ.) ss:')) | ||
| msec = int(validator(re_form ,'Введіть мілісекунди(необ.) ms: ')) | ||
|
|
||
| time = hours*3600 + min*60 + sec + msec*0.001 | ||
| print(time) | ||
|
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. name program |
||
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.
Change condition to "word[0].isupper()"