|
@@ -1,3 +1,5 @@
|
|
|
+from functools import reduce
|
|
|
+
|
|
|
|
|
|
def func_1():
|
|
|
a, b, *c = [1, True, 4, 6, 'hello ', 7, 9]
|
|
@@ -28,10 +30,66 @@ def func_2():
|
|
|
print(values)
|
|
|
|
|
|
|
|
|
+# def print_values(one, two, three):
|
|
|
+# print(one, two, three)
|
|
|
+
|
|
|
+
|
|
|
+def print_values(*values):
|
|
|
+ print(values, sep=',')
|
|
|
+
|
|
|
+
|
|
|
+def count_args(*args):
|
|
|
+ return len(args)
|
|
|
+
|
|
|
+
|
|
|
+def multiply(*args):
|
|
|
+ if not args:
|
|
|
+ return 1
|
|
|
+ return reduce(lambda a, b: a*b, args)
|
|
|
+
|
|
|
+
|
|
|
+def check_sum(*args):
|
|
|
+ return print("not enough") if sum(args) < 50 else print("verification passed")
|
|
|
+
|
|
|
+
|
|
|
+def is_only_one_positive(*args):
|
|
|
+ return len(list(filter(lambda x: x > 0, args))) == 1
|
|
|
+
|
|
|
+
|
|
|
+def print_goods(*args):
|
|
|
+ counter = 1
|
|
|
+ for x in args:
|
|
|
+ if isinstance(x, str) and x != "":
|
|
|
+ print(f'{counter}. {x}')
|
|
|
+ counter += 1
|
|
|
+ if counter == 1:
|
|
|
+ print('Нет товаров')
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
def main():
|
|
|
# func_1()
|
|
|
- func_2()
|
|
|
+ # func_2()
|
|
|
+
|
|
|
+ # words = 'Hello', 'Aloha', 'Bonjour'
|
|
|
+ # print_values(*words)
|
|
|
+
|
|
|
+ # print_values(1, 2, 3, 4)
|
|
|
+
|
|
|
+ # print(count_args(1, 2, 3, 4, 5))
|
|
|
+
|
|
|
+ # print(multiply(1, 2, 3, 4, 5))
|
|
|
+
|
|
|
+ # print(multiply(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 10))
|
|
|
+
|
|
|
+ # check_sum(10, 10, 10, 10, 9)
|
|
|
+
|
|
|
+ # print(is_only_one_positive(-3, -4, -1, 3, 4))
|
|
|
+
|
|
|
+ print_goods(1, True, 'Грушечка', '', 'Pineapple')
|
|
|
+
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- main()
|
|
|
+
|
|
|
+ main()
|