-
Notifications
You must be signed in to change notification settings - Fork 1
/
section_24.py
53 lines (35 loc) · 1.06 KB
/
section_24.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# def mult_by_2(num):
# return num*2
# time_two = mult_by_2
# print("4 * 2 = ", time_two(4))
# def do_math(func, num):
# return func(num)
# print("8 * 2 = ", do_math(mult_by_2, 8))
# def get_func_mult_by_num(num):
# def mult_by(value):
# return num * value
# return mult_by
# generated_func = get_func_mult_by_num(5)
# print("5 * 9 =", generated_func(9))
# list_of_funcs = [time_two, generated_func]
# print("5 * 9 =", list_of_funcs[1](9))
# def is_it_odd(num):
# if num % 2 == 0:
# return False
# else:
# return True
# def change_list(list, func):
# odd_list = []
# for i in list:
# if func(i):
# odd_list.append(i)
# return odd_list
# a_list = range(1,20)
# print(change_list(a_list, is_it_odd))
def random_func (name: str, age: int, weight: float) -> str:
print("Name: ", name)
print("Age :", age)
print("Weight :", weight)
return "{} is {} years old and weighs {}". format(name, age, weight)
print(random_func(89, "Derek", "Turtle"))
print(random_func.__annotations__)