Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions germanchukav/first/task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'''Вивести кількість порожніх елементів списку'''


list = [1,[],6,3,87,'абв',[]]
empty = list.count([])
print(empty)

Choose a reason for hiding this comment

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

def counter(list):
    result = list.count([])
    return result

Помилки відсутні

9 changes: 9 additions & 0 deletions germanchukav/first/task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'''Вивести всі слова, що містять велику букву'''


string = 'FdgdxsS hfdgfd dfsgJj'
result = []
for item in string.split():
if any(c.isupper() for c in item):
result.append(item)
print(result)

Choose a reason for hiding this comment

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

def uppercase(string):
    result = []
    for item in string.split():
        if any(c.isupper() for c in item):
            result.append(item)
    return result

Помилки відсутні

14 changes: 14 additions & 0 deletions germanchukav/first/task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'''Вивести суму чисел списку і рядок, шо складається з даних типу str'''


list = [1,2,4,7,2,'a',1,'і']
sum=0
string=str()
for i in range(0,len(list)):
if isinstance(list[i], int):
sum +=int(list[i])

elif isinstance(list[i],str):
string += list[i]
print(sum)
print(string)

Choose a reason for hiding this comment

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

def function(list):
    sum = 0
    string=str()
    for i in range(0,len(list)):
        if isinstance(list[i], int):
            sum +=int(list[i])

        elif isinstance(list[i],str):
            string += list[i]
    print(sum)
    print(string)

Єдина помилка пов'язана із табуляцією (рядочок №12)
Так, код працює

Empty file added germanchukav/second/task1.py
Empty file.