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 program that meets the following requirements: Cat Class Create a class called Cat which...
Write a program that meets the following requirements: Cat Class Create a class called Cat which has only the following instance variables: - name - breed - number of legs - year born Create the no-argument constructor Create the constructor which uses all fields as parameters Write the getter and setter methods for all instance variables Override the toString method using the example shown above There should be NO main method in the Cat class. CatTester Class Create a class...
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 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...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...
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...
Write a Python program in a file called consonants.py, to solve the following problem using a...
Write a Python program in a file called consonants.py, to solve the following problem using a nested loop. For each input word, replace each consonant in the word with a question mark (?). Your program should print the original word and a count of the number of consonants replaced. Assume that the number of words to be processed is not known, hence a sentinel value (maybe "zzz") should be used. Sample input/output: Please enter a word or zzz to quit:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT