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
2 changes: 2 additions & 0 deletions KornienkoT/first/task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lis = [1, 4 ,7 ,"f", [], [], []]
print (lis.count([]))

Choose a reason for hiding this comment

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

"""
Порахувати кількість порожніх списків у заданому списку
"""
def task2(lis):
    result = lis.count([])
    return result

Everything is ok
But, without name task

10 changes: 10 additions & 0 deletions KornienkoT/first/task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sentence = input()

Choose a reason for hiding this comment

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

Can improve input("Write text: ")

print (sentence)

CapLetters = sentence.split(" ")
print (CapLetters)

for word in CapLetters:
for symb in word:
if (symb.isupper()):
print (word)

Choose a reason for hiding this comment

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

"""
Вивести слова, які мястять хоча б одну велику букву
"""

def task2(capletters):
    for word in capletters:
        for symb in word:
            if (symb.isupper()):
                return word
print(task2(CapLetters))

Everything is ok
But, without name task

14 changes: 14 additions & 0 deletions KornienkoT/first/task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
lis = ["h","t", 3, 7, 9, {}]

Choose a reason for hiding this comment

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

def task3(lis):
    number = []
    string = []

    for i in lis:
        elem = type(i)
        if (elem == float or elem == int):
            number.append(i)

        elif (elem == str):
            string.append(i)

    print ( sum (number))
print (task3(lis))

number = []
string = []

for i in lis:
elem = type(i)
if (elem == float or elem == int):
number.append(i)

elif (elem == str):
string.append(i)

print ( sum (number))

Choose a reason for hiding this comment

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

Everything is ok
But, without name task