-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.py
More file actions
74 lines (54 loc) · 1.29 KB
/
functions.py
File metadata and controls
74 lines (54 loc) · 1.29 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""
def function_name(parameter_1, parameter_2, parameter_3 ...):
code
code
[optional] return ans_1, ans_2 ...
"""
"""
Time Complexity: O(1)
Space Complexity: O(1)
"""
def hello() -> None:
print('hello!')
# return None
# parameters
"""
Time Complexity: O(1)
Space Complexity: O(1)
"""
def full_name(first_name: str, last_name: str, middle_name=None) -> str:
if middle_name is None:
return f'{first_name} {last_name}'
return f'{first_name} {middle_name} {last_name}'
"""
Time Complexity: O(1)
Space Complexity: O(1)
"""
def sum_numbers(a: int, b: int) -> int:
return a + b
"""
Time Complexity: O(1)
Space Complexity: O(1)
"""
def multiple(k):
return k, 10
# print(hello)
# print(type(hello))
# invoke
# arguments
print(full_name('anish', 'sachdeva'))
print(full_name('wolfgang', 'mozart', 'amadeus'))
print(full_name('ada', 'lovelace', 'countess'))
print(full_name(last_name='turing', first_name='alan'))
print(full_name(last_name='bach', middle_name='sebastian', first_name='johanss'))
print(full_name('alan', last_name='turing'))
print('hello', end=' ** ')
# full_name('hello', 'world')
# print(full_name())
# print(hello())
# print(None)
# print(print())
# print(None)
val = multiple(sum_numbers(1, 3))
print(val)
# print(sum_numbers('hello', ' world'))