Добавил:
... Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
2
Добавлен:
28.06.2024
Размер:
787 б
Скачать
# 7.1.11. Напишіть функцію, яка перевіряє, чи подана послідовність порожня чи ні.

def Func(strList, strTuple, strDict):

print("List:", strList, "\nType:", type(strList))
if strList == []:
print("Empty:", True)
else:
print("Empty:", False)

print("Tuple:", strTuple, "\nType:", type(strTuple))
if strTuple == ():
print("Empty:", True)
else:
print("Empty:", False)

print("Dict:", strDict, "\nType:", type(strDict))
if strDict == {}:
print("Empty:", True)
else:
print("Empty:", False)

strList = list(input("List: "))
strTuple = tuple(input("Tuple: "))
strDict = dict(input("Dict: "))

Func(strList, strTuple, strDict)
Соседние файлы в папке Пр7