Question

In: Computer Science

Using Python, write a program that meets the following requirements: Make a list called sandwich_orders and...

Using Python, write a program that meets the following requirements:

  1. Make a list called sandwich_orders and fill it with the names of various sandwiches.
  2. Make an empty list called finished_sandwiches.
  3. Loop through the list of sandwich orders and spring a message for each order such as "I am working on your tuna sandwich"
  4. As each sandwich is made, move it to the list of finished sandwiches.
  5. After all the sandwiches have been made, print a message listing each sandwich that was made.
  6. Comment your code (with requirements above).

Solutions

Expert Solution

Python code:

#initializing a sample sandwich_orders list
sandwich_orders=["tuna sandwitch","vegetable sandwitch","chicken sandwitch"]
#initializing an empty finished_sandwiches list
finished_sandwiches=[]
#looping each item in sandwich_orders
for i in sandwich_orders:
#printing the sandwich in which working on
print("I am working on your "+i)
#adding that sandwich to finished_sandwiches list
finished_sandwiches.append(i)
#printing the sandwitches which are made
print("The sandwitches which are made are ",end="")
print(*finished_sandwiches,sep=", ")

Screenshot:


Output:


Related Solutions

Using Python, write a program named hw3a.py that meets the following requirements: Create a dictionary called...
Using Python, write a program named hw3a.py that meets the following requirements: Create a dictionary called glossary. Have the glossary include a list of five (5) programing words you have learned in chapters 4-6. Use these words as keys to your dictionary. Find the definition of these words and use them as the values to the keys. Using a loop, print each word and its meaning as neatly formatted output. Create three dictionaries called person. Have each of the person...
Using Python, write a program named hw3b.py that meets the following requirements: Welcome the user to...
Using Python, write a program named hw3b.py that meets the following requirements: Welcome the user to Zion's Pizza Restaurant and ask the user how many people are in their dinner group. If the answer is more than eight (8), print a message saying they'll have to wait for a table. Otherwise, report that their table is ready and take their order. Assume the client orders one pizza, and ask what he/she would like on their pizza, include a loop that...
Write a python program using the following requirements: Create a class called Sentence which has a...
Write a python program using the following requirements: Create a class called Sentence which has a constructor that takes a sentence string as input. The default value for the constructor should be an empty string The sentence must be a private attribute in the class contains the following class methods: get_all_words — Returns all the words in the sentence as a list get_word — Returns only the word at a particular index in the sentence Arguments: index set_word — Changes...
Write a Python program that performs the following list operations. Part A Define a list called...
Write a Python program that performs the following list operations. Part A Define a list called numList with elements. 84, 94, 27, 74, 19, 90, 16, 21, 56, 50, 77, 59, 41, 63, 18, 26, 80, 74, 57, 30, 40, 93, 70, 28, 14, 11, 43,65, 91, 83, 22, 53, 74, 44, 73, 55, 47, 74, 81 Display the followings: All the numbers in numList The number of elements in numList The smallest number in numList The largest number in...
1. Write a Java program from scratch that meets the following requirements: a. The program is...
1. Write a Java program from scratch that meets the following requirements: a. The program is in a file called Duplicates.java that defines a class called Duplicates (upper/lower case matters) b. The program includes a Java method called noDuplicates that takes an array of integers and returns true if all the integers in that array are distinct (i.e., no duplicates). Otherwise it returns false. Make sure the method is public static. example tests: noDuplicates({}) returns true noDuplicates({-1, 1}) returns true...
Write a C program that meets the following requirements. Uses a while loop to display the...
Write a C program that meets the following requirements. Uses a while loop to display the first 10 natural numbers (on one row, with a tab separating each number) Uses a while loop to find the sum of the second set of 10 natural numbers. Reads a user entry and displays all the natural numbers up to the user entry (on a column list with a new line separating each number). Finds and displays the sum of all natural numbers...
Use Python program. Make a list called groceries with the following values: "pineapple", "tangerine", and "peach"....
Use Python program. Make a list called groceries with the following values: "pineapple", "tangerine", and "peach". Define these two dictionaries in your program: stock = {     "pineapple": 6,     "peach": 0,     "tangerine": 32,     "pear": 15 } prices = {     "pineapple": 4,     "peach": 2,     "tangerine": 1.5,     "pear": 3 } Take one argument “item” as input from the user and returns the cost of that item. Assume the user will only input an item that...
USING PYTHON Write a program to create a number list. It will call a function to...
USING PYTHON Write a program to create a number list. It will call a function to calculate the average values in the list. Define main ():                        Declare variables and initialize them                        Create a list containing numbers (int/float)                        Call get_avg function that will return the calculated average values in the list.                                       Use a for loop to loop through the values in the list and calculate avg                        End main()
Using LIST and FUNCTION Write a program in Python that asks for the names of three...
Using LIST and FUNCTION Write a program in Python that asks for the names of three runners and the time it took each of them to finish a race. The program should display who came in first, second, and third place.
XML and JAVA Write a Java program that meets these requirements. It is important you follow...
XML and JAVA Write a Java program that meets these requirements. It is important you follow these requirements closely. • Create a NetBeans project named LastnameAssign1. Change Lastname to your last name. For example, my project would be named NicholsonAssign1. • In the Java file, print a welcome message that includes your full name. • The program should prompt for an XML filename to write to o The filename entered must end with .xml and have at least one letter...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT