-
Notifications
You must be signed in to change notification settings - Fork 51
second task1 #52
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?
second task1 #52
Conversation
|
|
||
| text = [1, [], 3, [], [], 12, [], 239] | ||
| result = text.count([]) | ||
| print(result) |
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_list_count(list): return list.count([])
| sth = text.split(" ") | ||
| for part in sth: | ||
| if (part[0].isupper()): | ||
| print(part) |
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 up_word(text):
for word in text.split(" "):
if word[0].isupper:
return word
return
| result2 = str(result2 + ' ' + value) | ||
| print(result1) | ||
| print(result2) | ||
|
|
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.
Помилок немає.
У вигляді функції:
res1=0
res2=""
def sum_str(list):
for el in list:
if isinstance(el, int):
return res1 + el
elif isinstance(el, str):
return res2+' '+el
| bad_sentences = re.findall('[a-z]+\.', string) | ||
| print(good_sentences) | ||
| print(bad_sentences) | ||
|
|
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.
Непотрібна функція print() після кожної дії.
| Виведіть результат. | ||
| """ | ||
|
|
||
| import re |
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.
Замість імпортування повного re, краще використати from re import findall.
|
|
||
| for element in range(len(bad_sentences)): | ||
|
|
||
| .append(bad_sentences[element]) No newline at end of file |
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.
Незрозуміла дія додавання елементів(речень), що почитаються с маленької літери. Треба застосувати функцію .title() для початку речення з великої літери.
No description provided.