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
julsineya [31]
3 years ago
11

Please write in python:

Computers and Technology
1 answer:
Alenkasestr [34]3 years ago
6 0

Week 1:

print("1. Skittles    2. M&M's\n3. Starbursts   4. Twizzlers\n5. Twix")

while True:

   item = input("Enter the number of your item to be purchased: ")

   if item == "1":

       print("You chose skittles.")

   elif item == "2":

       print("You chose M&M's.")

   elif item == "3":

       print("You chose Starbursts.")

   elif item == "4":

       print("You chose Twizzlers.")

   elif item == "5":

       print("You chose Twix.")

Week 2:

print("1. Skittles    2. M&M's\n3. Starbursts   4. Twizzlers\n5. Twix")

total = 0

while True:

   item = input("Enter the number of your item to be purchased: ")

   if item == "1":

       print("You chose skittles.")

       total += 2

   elif item == "2":

       print("You chose M&M's.")

       total += 2

   elif item == "3":

       print("You chose Starbursts.")

       total += 1

   elif item == "4":

       print("You chose Twizzlers.")

       total += 3

   elif item == "5":

       print("You chose Twix.")

       total += 4

   elif item == "exit":

       exit()

   elif item == "out":

       total += round(total*0.0625,2)

       print("Your total is: ${}".format(total))

       deposit = int(input("How much money did you input? "))

       change_due = round(deposit - total,2)

       print("Your change due is ${}".format(change_due))

   else:

       print("Please choose an option or enter \"exit\" to exit the vending machine.")

week 3:

print("1. Skittles    2. M&M's\n3. Starbursts   4. Twizzlers\n5. Twix")

total = 0

while True:

   item = input("Enter the number of your item to be purchased: ")

   if item == "1":

       print("You chose skittles.")

       total += 2

   elif item == "2":

       print("You chose M&M's.")

       total += 2

   elif item == "3":

       print("You chose Starbursts.")

       total += 1

   elif item == "4":

       print("You chose Twizzlers.")

       total += 3

   elif item == "5":

       print("You chose Twix.")

       total += 4

   elif item == "exit":

       exit()

   elif item == "out":

       total += round(total * 0.0625, 2)

       print("Your total is: ${}".format(total))

       deposit = int(input("How much money did you input? "))

       while deposit < total:

           deposit = int(

               input("Please input a dollar amount greater than or equal to the total (whole numbers only): "))

       change_due = round(deposit - total, 2)

       if change_due == 0:

           print("No change due.")

       else:

           print("You are owed {} dollars and {} cents".format(int(change_due), round(change_due - int(change_due),2)))

   else:

       print("Please choose an option or enter \"exit\" to exit the vending machine.")

week 4:

def print_menu():

   print("1. Skittles    2. M&M's\n3. Starbursts   4. Twizzlers\n5. Twix    Enter \"out\" to checkout.")

def calculate_total(new_item):

   total = 0

   if new_item == "1":

       print("You chose skittles.")

       total += 2

   elif new_item == "2":

       print("You chose M&M's.")

       total += 2

   elif new_item == "3":

       print("You chose Starbursts.")

       total += 1

   elif new_item == "4":

       print("You chose Twizzlers.")

       total += 3

   elif new_item == "5":

       print("You chose Twix.")

       total += 4

   return total

def make_change(change_due):

   print(

       "Here is your change: {} dollars and {} cents".format(int(change_due), round(int(change_due) - change_due, 2)))

   print("Have a great day")

def amount_due(total_price):

   sales_tax = 0.0625

   final_price = total_price * +(total_price * sales_tax)

   print("Subtotal: {}".format(total_price))

   print("Final total: {}".format(final_price))

   deposit = int(input("Enter how much you deposited: "))

   while deposit < final_price:

       deposit = int(input("Enter an amount greater than or equal to {}".format(final_price)))

   make_change(deposit - final_price)

total = 0

while True:

   item = input("Enter the number of your item to be purchased: ")

   if item == "1":

       print("You chose skittles.")

       total += 2

   elif item == "2":

       print("You chose M&M's.")

       total += 2

   elif item == "3":

       print("You chose Starbursts.")

       total += 1

   elif item == "4":

       print("You chose Twizzlers.")

       total += 3

   elif item == "5":

       print("You chose Twix.")

       total += 4

   elif item == "exit":

       exit()

   elif item == "out":

       sales_tax = 0.0625

       total += round(total * sales_tax, 2)

       print("Your total is: ${}".format(total))

       deposit = int(input("How much money did you input? "))

       while deposit < total:

           deposit = int(

               input("Please input a dollar amount greater than or equal to the total (whole numbers only): "))

       change_due = round(deposit - total, 2)

       if change_due == 0:

           print("No change due.")

       else:

           print(

               "You are owed {} dollars and {} cents".format(int(change_due), round(change_due - int(change_due), 2)))

   else:

       print("Please choose an option or enter \"exit\" to exit the vending machine.")

I didn't implement the functions because the problem never stated that we had to. Best of luck.

You might be interested in
Which of the following is a basic concept associated with Web 2.0? Select one: a. shift in user's role from the passive consumer
soldier1979 [14.2K]

Answer:

A: shift in user's role from the passive consumer of content to its creator

Explanation:

During the phase of Web 2.0, consumers evolved from just been highly informed and socially connected (in other words, they evolved from being just passive consumers) to a more engaged and empowered consumer. This implied that consumers could easily adapt to new technologies to meet individual needs and create an emotional bond with brands. They evolved from passive consumers to being the creators of what they wanted to meet their specific needs.

5 0
4 years ago
What is an IF statement used for?
kiruha [24]

The IF statement is a decision-making statement that guides a program to make decisions based on specified criteria. The IF statement executes one set of code if a specified condition is met (TRUE) or another set of code evaluates to FALSE.

8 0
3 years ago
Which option is used in emails to inform the recipient that they should exercise discretion in accordance with sharing the conte
Kay [80]
Priority levels hehe good luck!
5 0
3 years ago
If an internet document identifies its author but says nothing about her or his qualifications, your textbook recommends that yo
PSYCHO15rus [73]

If the internet document identifies the author, the textbook recommends that you type the author's name into the internet search box.

<h3>What is an internet document?</h3>

These are those documents that are gotten from the a search on the internet. To cite such items there are certain guidelines that are to be followed.

A simple search on a search engine would show you the most important details that this author possesses.

Read more on internet documents here:

brainly.com/question/14715750

5 0
3 years ago
Why is it worth remembering “All people seem to need data processing”?
Rzqust [24]
The answer is .........C
3 0
4 years ago
Read 2 more answers
Other questions:
  • Which of the following statements is true of a database? a. It is a collection of unstructured data. b. It is accessed primarily
    14·1 answer
  • Write statementsto show how finding the length of a character array char [ ] differs from finding the length of a String object
    9·1 answer
  • In which format is information stored on a hard drive?
    5·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
  • The purpose of the ___________ is to provide sufficient notice to individuals whose personal information has been stolen so they
    13·1 answer
  • A derived class is a class that inherits data members and functions from a ____ class.
    6·1 answer
  • What is the second row of letters in the keyboard called?
    6·1 answer
  • What is a photographic print made from a negative image?
    7·1 answer
  • Which three pieces of information should be included in an artist statement? Select all that apply.
    11·1 answer
  • When an event occurs, the agent logs details regarding the event. what is this event called?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!