123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- import math
- def decorator_function(func_to_be_called):
- def wrapper(*args, **kwargs):
- print("Some text before calling function")
- func_to_be_called(*args, **kwargs)
- print("Some text after calling function")
- return wrapper
- @decorator_function
- def print_function(text):
- print("Your text is:", text)
- # print_function("Hello")
-
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- from datetime import datetime
- def decorator_function(func_to_be_called):
- def wrapper(*args, **kwargs):
- print("Some text before calling function")
- func_to_be_called(*args, **kwargs)
- print("Some text after calling function")
- return wrapper
- def time_sum(func):
- def wrapper(text):
- d1 = datetime.now()
- print("Time before calling", d1)
- func(text)
- d2 = datetime.now()
- print("Time after calling", d2)
- print(d2 - d1)
- return wrapper
- @time_sum
- @decorator_function
- def print_function(text):
- print("Your text is:", text)
- # print_function("Hello")
-
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- def decorator_function(func_to_be_called):
- def wrapper(text):
- print("Some text before calling function")
- result = func_to_be_called(text)
- print("Some text after calling function")
- return result
-
- return wrapper
- @decorator_function
- def print_function(text):
- return "Your text is: " + text
- # print(print_function("Hello"))
- def decorator(func):
- def wrapper(a, b):
- if a < 0 or b < 0:
- print("YES")
- result = func(a, b)
- return result
- return wrapper
- # Connect decorator please
- @decorator
- def main(a, b):
- return a + b
- # x, y = [int(x) for x in input().split()]
- # print(main(3, 6))
- # print(main(-3, 6))
- def test_exc_1(a, b):
- res = 0
- try:
- print(a/b)
- except Exception as e:
- print("Error:", Exception)
- def test_exc_2(a, b):
- res = 0
- try:
- print(a/b)
- except ZeroDivisionError:
- print("Error")
- except:
- print("Something another")
- def test_exc_3():
- try:
- a, b = int(input()), int(input())
- print(a +b)
- except:
- print("error")
- finally:
- print("end")
- def test_exc_4():
- try:
- a, b = int(input()), int(input())
- print(a + b)
- except:
- print("error")
- else:
- print("end")
- def test_raise():
- a, b = int(input()), int(input())
- if a + b == 3:
- raise RuntimeError("Oops, sum is 3")
- else:
- print(a + b)
-
- def is_prime(n):
- if n < 2:
- return False
- for i in range(2, int(math.sqrt(n)) + 1):
- if n%i == 0:
- return False
- return True
- # primes = [i for i in range(1, 20) if is_prime(i)]
- # print(primes)
- def task_1():
- print(len(input().split()))
- # task_1()
-
- def task_2():
- s1 = input()
- s2 = input()
- flag = True
- for i in s2:
- if i not in s1:
- flag = False
- print("Да, первая строка содержит все символы второй строки") if flag else print("Нет, первая строка не содержит все символы второй строки")
- task_2()
- s1 = input()
- s2 = input()
- flag = True
- for i in s2:
- if i not in s1:
- flag = False
- print("Да, первая строка содержит все символы второй строки") if flag else print("Нет, первая строка не содержит все символы второй строки")
|