@@ -0,0 +1,25 @@
|
||||
def check_number(item):
|
||||
return isinstance(item, (int, float))
|
||||
|
||||
|
||||
|
||||
def calculate_total_sum(nested_list):
|
||||
new_summ = 0
|
||||
for i in nested_list:
|
||||
if isinstance(i, (list, tuple)):
|
||||
new_summ += calculate_total_sum(i)
|
||||
elif check_number(i):
|
||||
new_summ += i
|
||||
return new_summ
|
||||
|
||||
|
||||
def process_data(data, limit):
|
||||
if calculate_total_sum(data) <= limit:
|
||||
return True
|
||||
else:
|
||||
print("Превышен лимит")
|
||||
return False
|
||||
|
||||
|
||||
print(check_number("u"))
|
||||
print(process_data(data = (3,4,6,6,7,(1000,300)), limit = 100))
|
||||
Reference in New Issue
Block a user