1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
stiks02 [169]
3 years ago
9

Write a program called DeliveryCharges for the package delivery service in Exercise 4. The program should again use an array tha

t holds the 10 zip codes of areas to which the company makes deliveries. Create a parallel array containing 10 delivery charges that differ for each zip code. Prompt a user to enter a zip code, and then display either a message indicating the price of delivery to that zip code or a message indicating that the company does not deliver to the requested zip code.
Computers and Technology
1 answer:
lukranit [14]3 years ago
6 0

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

You might be interested in
Explain how being a metal, metalloid, or non-metal affects conductivity
KatRina [158]
Metals are the greatest conductors of electricity. metalloids are fair conductors because they have features of both nonmetals and metals. Nonmetals are poor conductors. 
8 0
3 years ago
What is the absolute pathname of the YUM configuration file? REMEMBER: An absolute pathname begins with a forward slash
ale4655 [162]

Answer:

/etc/yum.conf

Explanation:

The absolute pathname for YUM is /etc/yum.conf. The configuration file For yum and related utilities can be found there. The file has one compulsory section, and this section can be used to place Yum options with global effect, it could also have one or more sections, that can enable you to set repository-specific options.

4 0
4 years ago
According to the video, what kinds of projects would Computer Programmers be most likely to work on? Check all that apply.
ivann1987 [24]
The answer is computer hardware
3 0
3 years ago
Read 2 more answers
Which of the following terms best describes the security domain that relates to how data is classified and valued?
d1i1m1o1n [39]

Answer:

c) Access Control.

Explanation:

The term which describes the security domain best that relates to  how the data is valued and classified is Access Control.

Access Control :It is the restriction of access of a resource or a place that is selective.Permission to access a resource is called authorization.It is an important term in the field of information security and physical security.

7 0
3 years ago
Your task is to build a palindrome from an input string.A palindrome is a word that readsthe same backward or forward. Your code
White raven [17]

Answer:

The program in Python is as follows:

word = input("Word: ")

if len(word) < 5:

   print("At least 5 characters")

else:

   pal = word[0:5]

   word = word[0:4]

   word = word[::-1]

   pal+=word

   print(pal)

Explanation:

This gets the word from the user

word = input("Word: ")

This checks if the length of the word is less than 5.

if len(word) < 5:

If yes, this tells the user that at least 5 characters is needed

   print("At least 5 characters")

If otherwise

else:

This extracts the first 5 characters of the word into variable named pal

   pal = word[0:5]

This extracts the first 5 characters of the word into variable named word

   word = word[0:4]

This reverses variable word

   word = word[::-1]

This concatenates pal and word

   pal+=word

This prints the generated palindrome

   print(pal)

7 0
3 years ago
Other questions:
  • What human activity would cause a decrease in the population of another species? (The action of humans would impact one species,
    9·1 answer
  • HELP ME RIGHT NOW !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    8·1 answer
  • when seeking information on the on the internet about a variety of subjects the most useful place to look would be?
    13·1 answer
  • How does scarcity affect what gets produced
    5·1 answer
  • 4+4 act quick for brainliest
    10·2 answers
  • Click on the _____ tab on the ribbon to open the backstage view.
    7·1 answer
  • What can you find the under the privacy policy section of a shopping website?
    12·1 answer
  • In Super Mario Bros., you become Mario and your friend is Mario’s younger brother Luigi. Your job is to race through Mushroom Ki
    10·1 answer
  • The most common technique for using an appropriate synchronization mechanism to serialize the accesses to prevent errors is to a
    13·1 answer
  • Define foreign employment​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!