Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dahnovskauo/first/task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'''
Вивести кількість порожніх списків
'''
a = [1, 3, 'a', 123, [], 'hello', []]
print('Кількість порожніх списків:', a.count([]))
10 changes: 10 additions & 0 deletions dahnovskauo/first/task2.py
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):

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()"

list.append(word)
print(list)
20 changes: 20 additions & 0 deletions dahnovskauo/first/task3.py
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] +' '

Choose a reason for hiding this comment

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

delete this: +' '

else:
print('Кінець')
Comment on lines +12 to +13

Choose a reason for hiding this comment

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

delete this
else: print('Кінець')

print('Сума:', sum)
print('Конкатенація:', q)