Skip to content

Conversation

@AndyLanYT
Copy link

No description provided.


text = [1, [], 3, [], [], 12, [], 239]
result = text.count([])
print(result)

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)

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)

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)

Choose a reason for hiding this comment

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

Непотрібна функція print() після кожної дії.

Виведіть результат.
"""

import re

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

Choose a reason for hiding this comment

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

Незрозуміла дія додавання елементів(речень), що почитаються с маленької літери. Треба застосувати функцію .title() для початку речення з великої літери.

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.

4 participants