In my job, I receive cartons from a manufacturer. The cartons are serially numbered and certain cartons (the first 5, those ending with 20, 50, 90 and the last 5) have to be opened and inspected. As can be seen from the code below, I think I have nailed down the issue of the first and last five cartons. I am stumped over the ones ending with 20, 50,90. The first_carton and last_carton numbers depend on the current batch of cartons.
"""
This script helps arrange cartons for inspection
How the system works:
* Lay out the first 5 cartons in the list
* Lay out the last 5 cartons in the list
* Lay out cartons ending with 20, 50, 90
"""
#Prompt the user to enter the first carton number
first_carton = int(input("First Carton: "))
#The last carton number
last_carton = int(input("Last Carton: "))
#Make the first carton number and last carton number (+1) into a range
# and make all the numbers inthe range into a list
carton_list = list(range(first_carton, last_carton+1))
#Get the first and last 5 carton numbers by slicing the carton list
firstFive = carton_list[0:5]
lastFive = carton_list[-5:]
# Function to print out numbers ending in 20, 50, and 90
def print_20_50_90_cartons():
for i in carton_list:
if i #ENDS WITH 20,50,90#:
print(i)