Professional Documents
Culture Documents
Practical 3 Develop Programs To Learn Concept of Functions Scoping, Recursion and List Mutability
Practical 3 Develop Programs To Learn Concept of Functions Scoping, Recursion and List Mutability
Practical 3 Develop Programs to learn concept of functions scoping, recursion and list
mutability.
ctr=0
def fibo(a,b,crt):
c=a+b
print(c)
a=b
b=c
global ctr
ctr=ctr+1
if(ctr <10):
fibo(a,b,ctr)
else:
return c
print(0)
print(1)
fibo(0,1,ctr)
Output:
0
1
1
2
3
5
8
13
21
34
55
89
Patel Dhruv Batch-A 160410116084
3.2:
from PY import calM
a=int(input("Enter a: "))
b=int(input("Enter b: "))
print(calM.add(a, b))
print(calM.sub(a, b))
print(calM.mul(a, b))
print(calM.div(a, b))
print(calM.mod(a, b))
print(calM.rec(a))
print(calM.nigate(a))
print(calM.sqrt(a))
Output:
Enter a: 20
Enter b: 10
30
10
200
2.0
0
0.05
-20
4.47213595499958