I just need to know why my UI doesn’t read the integer ’14’ as a 2 digit number instead of 2 1 digit numbers. I need the for loop that assigns pack to checkPackage because I need pack to represent whatever package id is entered. I originally took out the ‘int’ part, and it wouldn’t assign pack to the package ids at all
elif option == "3":
checkPackage = input('Please enter a package using its package ID')
checkTime = input('Please enter a time in the form "00:00:00"')
hour, minute, second = checkTime.split(":")
rtime = datetime.timedelta(hours=int(hour), minutes=int(minute), seconds=int(second))
for package_id in checkPackage:
pack = myHash.search(int(package_id))
if rtime < pack.timeLeftHub0:
pack.status = 'At Hub'
print(str(pack.package_id) + ' package status at ' + str(rtime) + ' = ' + str(pack.status))
elif rtime == pack.time_delivered:
pack.status = 'Delivered'
print(str(pack.package_id) + ' package status at ' + str(rtime) + ' = ' + str(pack.status))
elif rtime > pack.time_delivered:
pack.status = 'Delivered'
print(str(pack.package_id) + ' package status at ' + str(rtime) + ' = ' + str(pack.status))
else:
pack.status = 'En Route'
print(str(pack.package_id) + ' package status at ' + str(rtime) + ' = ' + str(pack.status))
When I run my UI and do option 3, I get this:
What Would You Like to Check Today?
- All package statuses and Total Truck mileage at the end of day
- Status of all Packages at a given time
- Single package status with a given time
- Exit the program
Choose an option (1,2,3, or 4): 3
Please enter a package using its package ID14
Please enter a time in the form “00:00:00″10:00:00
1 package status at 10:00:00 = Delivered
4 package status at 10:00:00 = Delivered