-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.txt
77 lines (66 loc) · 1.68 KB
/
code.txt
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def namedetails():
n=str(input("Enter Your Name: "))
for i in n:
if i.isdigit() or ord(i) not in range(65,123):
print("\nEnter correct details\n")
return details()
break
return n
def numdetails():
try:
cdet=int(input("Enter Your Contact Number: "))
return cdet
except ValueError:
print("\nEnter the correct details\n")
return numdetails()
name=namedetails()
num=numdetails()
def slocation():
try:
s=float(input("Enter Source: "))
if s<0:
print("\nEnter positive source\n")
return slocation()
except:
print("\nEnter the correct source\n")
return slocation()
return s
def dlocation():
try:
d=float(input("Enter Destination: "))
if d<0:
print("\nEnter positive destination\n")
return dlocation()
except:
print("\nEnter the correct destination\n")
return dlocation()
return d
def call():
source=slocation()
destination=dlocation()
check(source,destination)
call()
def check(source,destination):
if destination < source or destination==source:
print("Enter correct value")
call()
km=destination-source
if km<0:
km=km*(-1)
def vehicle():
cat=input("Enter the Category bike or car or auto: ")
cat.lower()
if cat=="bike":
c=km * 10
return c,cat
elif cat=="car":
c=km * 30
return c,cat
elif cat=="auto":
c=km * 20
return c,cat
else:
print("enter bike or car or auto")
return vehicle()
cost,v=vehicle()
print("\n\nINVOICE""\nNAME:",name,"\nNUMBER:",num,"\nSOURCE:",source,"\tDESTINATION:",destination,"\nvechicle:",v,"\nTOTAL Km:",km,"km","\nCOST:",cost,"rs")