-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode(function program ) python language.py
More file actions
60 lines (44 loc) · 1.19 KB
/
Copy pathcode(function program ) python language.py
File metadata and controls
60 lines (44 loc) · 1.19 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
#taking input from user through argument
def name(name1,name2):
print(f"Helo! {name1},{name2}")
name(input("Enter the name:- ") , input("Enter the name:- "))
example of keyword argument
def name(name1,name2):
print("Heloo! ",name1,name2)
name(name1="Vishwas",name2="Verma")
example of poistional argument
def name(name1,name2):
print("Hi!",name1,name2)
name("Vishwas","Sandesh")
example of default argument
1st
def name(name1="Vishwas"):
print("Hi!",name1)
name()
2nd
def name(name1="Vishwas"):
print("Hi!",name1)
name("Sandesh")
example of variable lenth argument
1stdef test(**arg):
print(type(arg))
print(len(arg))
print(arg)
test(name1="Vishwas",name2="sandehs",name3="Neha")
2nd
def test(*arg):
print(type(arg))
print(len(arg))
print(arg)
test("Vishwas","sandehs","Neha")
#short program of command line
from sys import argv
print(argv)
print(type(argv))
program of calculator by fnctions
def calculator(a,b):
print("\nAddition:- ",a+b)
print("Substtraction:- ",a-b)
print("Multiplication:- ",a*b)
print("Division:- ",a/b)
calculator(a=int(input("Enter the number:-")),b=int(input("Enter the number:- ")))