-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path*args **args.py
More file actions
71 lines (31 loc) · 952 Bytes
/
*args **args.py
File metadata and controls
71 lines (31 loc) · 952 Bytes
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
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# function witout arguement and return void
def my_fun():
print("hello world")
my_fun()
# function with arguement and return void
def my_func_withparam(name):
print(name)
my_func_withparam("uzair")
def my_func_withparam_default(name = "UZAIR"):
print(name)
my_func_withparam_default()
my_name = my_func_withparam("Uzair")
print(type(my_name))
# it will return NoneType so the reutrn type of my_name is Void
# function with arguement and return Int
def add_two_number(num1,num2):
return num1+num2
addVal = add_two_number(2,4)
print(type(addVal))
# it will return Int so the reutrn type of addVal is Int
# **args
# it takes an arguemetns as dictionary
def my_func_dict(**args):
return args
# you can not call this by simple my_func_dict(4) because it must take dictionary
print(my_func_dict(val = 4)['val'])
# In[ ]:
# In[ ]: