-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday8.py
More file actions
57 lines (55 loc) · 1.56 KB
/
day8.py
File metadata and controls
57 lines (55 loc) · 1.56 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
# '*' = *args = positional
# '**' = **kwags = keyword based
# def fun_name(name,age):
# z = name+age
# print(z)
# fun_name(name='ABC',age =32 )
# fun_name("ABC",32)
# fun_name("ABC",age=32)
# def main():
# a = int(input("Enter a value of a : "))
# b = int(input("Enter a value of b : "))
# #print("in function main ............dir()= %s", %(dir()))
# print("in function main .............dir() =",dir())
# result = absdiff(a,b)
# #print(" the absolute value of %d - %d = %d" %(a,b,result))
# print("the absolute value of",a,"-",b,"=",result)
# def absdiff(x,y):
# #print("in function absdiff.....dir() = %s"%(dir()))
# print("in function absdiff.......dir() = ",dir())
# if x > y:
# z = x-y
# else:
# z = y-x
# return z
# main()
# incremental development / scaffloding
# def dist(x1,x2,y1,y2):
# d_x = x2-x1
# d_y = y2-y1
# sqx =d_x**2
# sqy =d_y**2
# plus = sqx+sqy
# sqrt = plus ** 0.5
# print(sqrt)
# dist(1,4,2,6)
# wt is composition in python
# def distance(x1,x2,y1,y2):
# return (((x2-x1) ** 2) + ((y2 - y1) ** 2)) ** (1/2)
# cx = int(input("Enter a cx : "))
# cy = int(input("Enter a cy : "))
# px = int(input("Enter a px : "))
# py = int(input("Enter a py : "))
# def circledata(cx,cy,px,py):
# return (3.14 * (distance(cx,px,cy, py) ** 2))
# print(circledata(cx,cy,px,py))
# factorial
a = int(input("Enter a integer : "))
def fact (n):
if (n==0):
return 1
else :
recurse = n*fact(n-1)
return recurse
print(fact(a))
# wt is type checking