-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharguments.py
54 lines (39 loc) · 1.21 KB
/
arguments.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
54
# def func(name):
# print("hello",name)
# func("biomagician")
# DEFAULT ARGUMENTS--------------->
# def name(fname, mname = "Jhon", lname = "Whatson"):
# print("Hello,", fname, mname, lname)
# KEY ARGUMENTS---------------->
#
# name("vibhu","singh","gharwar")
# def name(fname, mname, lname):
# print("Hello,", fname, mname, lname)
#
# name(mname = "Peter", lname = "Wesker", fname = "Jade")
#REQUIRED ARGUMENTS---------------->
# def name(fname, mname, lname):
# print("Hello,", fname, mname, lname)
#
# name("Peter", "Quill","vibhu")
#VARIABLE LENGTH ARGUMENT---------------->
def average(*numbers):
# print(type(numbers))
sum = 0
for i in numbers:
sum = sum + i
# print("Average is: ", sum / len(numbers))
# return 7
return sum / len(numbers)
# average(4, 6)
# average(b=9)
c = average(5, 6, 7, 1)
print(c)
# def name(**name):
# # print(type(name))
# print("Hello,", name["fname"], name["mname"], name["lname"])
# name(mname="Buchanan", lname="Barnes", fname="James")
#RETURN STATEMENT-------------->
def name(fname, mname, lname):
return "Hello, " + fname + " " + mname + " " + lname
print(name("James", "Buchanan", "Barnes"))