Advertisement
Guest User

Laboni

a guest
Jun 25th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.37 KB | None | 0 0
  1. def readAllData01(List_of_data01):
  2.     result=[]
  3.     with open(List_of_data01,'r') as file_n:
  4.         for i in file_n.readlines():
  5.                 result.append(tuple(i.split()))
  6.     return result
  7. def readAllData02(List_of_data02):
  8.     result=[]
  9.     with open(List_of_data02,'r') as file_n:
  10.         for i in file_n.readlines():
  11.                 result.append(tuple(i.split()))
  12.     return result
  13. def input_(List_of_data01=None,List_of_data02=None):
  14.     print(len(List_of_data01))
  15.     Current_location = input("Enter your current location : ")
  16.     Location_traveling = input("Enter your location : ")
  17.     No_of_passengers = input("Enter passengers : ")
  18.     print(Current_location,Location_traveling,No_of_passengers)
  19.     for i in List_of_data01:
  20.         if i[7] == Current_location:
  21.             if i[6]<=No_of_passengers:
  22.                 print("Driver Name = ",i[0])
  23.                 print("Driver Phone Number = ",i[1])
  24.                 print("Driver Rating = ",i[10])
  25.     else:
  26.         print("Sorry! No Car is available in your location right now")
  27.  
  28. if __name__=='__main__':
  29.     List_of_data01=readAllData01('uber_drivers.txt')
  30.     List_of_data02=readAllData02('location.txt')
  31.     print("List Of Driver =: ")
  32.     print(List_of_data01)
  33.     print(end="")
  34.     print("List of Location : ")
  35.     print(List_of_data02)
  36.     client_input = input_(List_of_data01,List_of_data02)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement