Short coding questions. (Python)

 

Please check materials uploaded.

7-3: Restaurant Seating III
Write a while loop which asks a line of customers how many people are in their
dinner group, and then tell them how long their wait is. Write three versions of
the program that exit the while loop in three different ways:
(a) Ask if there are any more customers in line. Use a conditional statement in
the while statement to stop the loop when the answer is “no”.
(b) Use an active variable to control how long the loop runs.
(c) Use break statement to exit the loop when the customer says “no”.

7-4: Sandwiches
Make a list called “sandwiches” and fill it with the names of five different
sandwiches. Then make an empty list called “finished”. Use a while loop to loop
through the list of sandwich orders and print a message for each order, such as “I
making a tuna sandwich.” As each sandwich is made, move it to the “finished”
list. After all the sandwiches have been made, print out the list of “sandwiches”
(which should be empty) and the list of “finished” sandwiches.

7-5: No Pastrami

Make a list called “sandwiches” and fill it with the names of eight sandwiches,
with the sandwich ‘pastrami’ appearing in the list three times. Add code near the
beginning of your program to print a message saying “the deli has run out of
pastrami”, and then use a while loop to remove all occurrences of ‘pastrami’ from
the “sandwiches” list. Then run the program moving “sandwiches” to “finished”.
Make sure no pastrami sandwiches end up in the “finished” list.

7-6: Sandwich Orders
Write a program that asks customers their name and their order. Write a prompt
similar to “which sandwich would you like”. Keep track of the names and orders
in a dictionary called “orders”. Include a block of code that ends the poll when
everyone has been asked to order a sandwich. Print the results of the poll in the
form “John wants a tuna sandwich,” etc

Extra Credit (1 point):
Then make an empty dictionary called finished_sandwiches. Loop through the
dictionary of sandwich orders and print a message for each order, such as “Pete,I
made your tuna sandwich.” As each sandwich is made, move it to the dictionary
of finished_sandwiches and remove it from the orders dictionary. After all the
sandwiches have been made, print the two dictionaries to show that all
sandwiches have been made.

Extra Credit (2 pts):
Create two dictionaries with names and ages. One dictionary has 3 women: Sue is
20, Ann is 29, and Liz is 34. The other dictionary has 3 men: Bob is 28, Abdul is 32,
and Ramon is 22. Write a program that merges the two dictionaries in a third
dictionary so that their ages are arranged numerically, that is, so that Sue is the
first key, Ramon is the second, and so on.

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more