-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeywords.py
More file actions
executable file
·49 lines (36 loc) · 1.26 KB
/
keywords.py
File metadata and controls
executable file
·49 lines (36 loc) · 1.26 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
def func(location, name='Shoukrey', job='Developer'):
""" func(location, name=, job=) ==> just for testing keyword concept
:param location: is required parameter
:param name: is default parameter (you have to specify keyword)
:param job: is default parameter (you have to specify keyword)
:return: string that contains information of this project's author
"""
return " ".join([name, job, location])
def func1(**info):
for i in info.keys():
print(f"{i}: {info[i]}")
# multiple(unlimited) arguments
def fun2(*args):
for arg in args:
print(arg)
def main():
# ignoring default parameters and just type required params
# print(func('Sudan'))
# this will result in "Shoukrey Tom Developer Sudan"
# print(func(name="Shoukrey Tom", location='Sudan'))
# binding dictionary to the function
info = {
"author": "Shoukrey Tom",
"job": "developer",
"location": "Sudan"
}
func1(**info)
# args = ["arg1", "arg2", "arg3", "arg4", "arg5"]
# fun2(*args)
# print("========================================")
# fun2("arg1", "arg2", "arg3", "arg4", "arg5")
# docstring
# print(func.__doc__)
# TODO: uncomment all comments
if __name__ == '__main__':
main()