Answer:
zip_codes = ["11111", "22222", "33333", "44444", "55555", "66666", "77777", "88888", "99999", "00000"]
charges = [3.2, 4, 1.95, 5.7, 4.3, 2.5, 3.8, 5.1, 6.6, 7.3]
deliver = False
index = -1
zip_code = input("Enter the zip code: ")
for i in range(len(zip_codes)):
if zip_code == zip_codes[i]:
deliver = True
index = i
break
if deliver:
print("The charge of delivery to " + zip_codes[index] + " is $" + str(charges[index]))
else:
print("There is no delivery to " + zip_code)
Explanation:
*The code is in Python.
Initialize the zip_codes array with 10 zip codes
Initialize the charges array with 10 corresponding values
Initialize the deliver as False, this will be used to check if the zip code is in the zip_codes
Initialize the index, this will be used if the zip code is a valid one, we will store its index
Ask the user to enter the zip_code
Create a for loop that iterates the length of the zip_codes array. Inside the loop:
Check if the zip_code is equal to the any of the items in the zip_codes. If it is, set the deliver as True, set the index as i, and break
When the loop is done, check the deliver. If it is True, then print the charge of the delivery. Otherwise, print that there is no delivery to that zip code