Advertisement
MORGATRON16

Untitled

Sep 8th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. def read_route_data():
  4.   routesList = []
  5.   with open("routes.txt", "rt") as in_file:
  6.     routes = in_file.read()
  7.   tempList = routes.split(',')
  8.   i = 0
  9.   while i < tempList.len:
  10.     x = tempList[i]
  11.     i = i + 1
  12.     y = tempList[i]
  13.     routesList.append({'route_number': x, 'happy_ratio': y})
  14.   return routesList
  15.  
  16. def sort_route_data(routesList):
  17.   currentBest = 0
  18.   for i in routesList.len:
  19.     if (i == routesList.len):
  20.       print ("fuk ya cunt")
  21.       continue
  22.     elif (i > routesList.len):
  23.       print ("bigger")
  24.       continue
  25.     else:
  26.       break
  27.    
  28.  
  29.  
  30.  
  31. while True:
  32.   try:
  33.     n = input ("How many routes can have an extra bus? ")
  34.     n = int (n)    
  35.   except ValueError:
  36.       print ("Invalid value. Please enter a non-negative integer")
  37.       continue
  38.   if n < 0:
  39.       print("Invalid value. Please enter a non-negative integer")
  40.       continue
  41.   else:
  42.     break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement