-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut10.py
More file actions
60 lines (50 loc) · 1.14 KB
/
tut10.py
File metadata and controls
60 lines (50 loc) · 1.14 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
# functions
# user-defined functions
# '''function definition'''
# def function_name():
# pass
# '''function call'''
# function_name()
# print("this is a statement")
# parameter - variables to be used in the function
# def newFunc(x, y):
# return x - y
# a = 10
# b = 5
# callFunc = newFunc(a, b)
# print("the value is", callFunc)
# def func():
# for i in range(4):
# print("Hello world")
# func()
'''
def newFuncs(x, y):
return x * y
# newFuncs(5) will give error because the argument and the parameter do not match
printValue = newFuncs(5, 10)
print(printValue)
'''
# default argument
# def display(name, course="BCA"):
# print("Name:", name)
# print("Course:", course)
# my_name = "Rajjit"
# display(my_name)
# lambda function
'''
syntax: lambda argument: expression
'''
# def sum(x, y):
# print(x + y)
# sum(12, 8)
# sum2 = lambda x, y : x + y
# print(sum2(12, 12))
# Q. write a program to check whether two number are equal or not
def check(a, b):
if(a == b):
print("a and b are equal")
elif (a > b):
print("a is greater than b")
else:
print("a is lesser than b")
check(5, 12)