Create a Peanut Butter and Grape Jelly Maker using Python. The program should prompt the user to select form different options to make a peanut butter and grape jelly sandwich. The user should be able to choose from three different types of bread, three different types of peanut butter, and three different types of grape jelly. The user should also receive information about their sandwich before they accept the sandwich. All the information must be printed to the terminal. For guidance, you can follow the steps below. If you feel like something is missing, then please add it to your program. Welcome users to the sandwich maker program Prompt users to select the bread option they would like to use for their sandwich Prompt users to select the peanut butter option they would like to use for their sandwich Prompt users to select which grape jelly option they would like to use for their sandwich Display the user-input sandwich information to the user Ask the user if the sandwich information is correct Make the sandwich

User Icon for Bot GPT 4-o mini Bot GPT 4-o mini answered
7 days ago

Hereโ€™s a simple Python program that allows users to create a Peanut Butter and Grape Jelly sandwich by selecting different options for bread, peanut butter, and jelly. The program will confirm the user's choices before finalizing the sandwich.

```python
def welcome():
print("Welcome to the Peanut Butter and Grape Jelly Sandwich Maker!")

def choose_bread():
print("Please choose your bread:")
breads = ["White Bread", "Whole Wheat Bread", "Sourdough Bread"]
for index, bread in enumerate(breads, start=1):
print(f"{index}. {bread}")

choice = int(input("Enter the number of your choice: "))
return breads[choice - 1]

def choose_peanut_butter():
print("Please choose your peanut butter:")
peanut_butters = ["Creamy Peanut Butter", "Crunchy Peanut Butter", "Natural Peanut Butter"]
for index, pb in enumerate(peanut_butters, start=1):
print(f"{index}. {pb}")

choice = int(input("Enter the number of your choice: "))
return peanut_butters[choice - 1]

def choose_jelly():
print("Please choose your grape jelly:")
jellies = ["Concord Grape Jelly", "Natural Grape Jelly", "Homemade Grape Jam"]
for index, jelly in enumerate(jellies, start=1):
print(f"{index}. {jelly}")

choice = int(input("Enter the number of your choice: "))
return jellies[choice - 1]

def confirm_sandwich(bread, peanut_butter, jelly):
print("\nYour sandwich configuration:")
print(f"Bread: {bread}")
print(f"Peanut Butter: {peanut_butter}")
print(f"Grape Jelly: {jelly}")

confirmation = input("Is all this information correct? (yes/no): ").strip().lower()
return confirmation == 'yes'

def make_sandwich():
welcome()
bread = choose_bread()
peanut_butter = choose_peanut_butter()
jelly = choose_jelly()

if confirm_sandwich(bread, peanut_butter, jelly):
print("Great! Your sandwich is being made...")
print("Enjoy your Peanut Butter and Grape Jelly sandwich!")
else:
print("Let's start over!")
make_sandwich()

if __name__ == "__main__":
make_sandwich()
```

### Explanation of the Program:
1. **Welcome Function**: Welcomes the user to the application.
2. **Choose Functions**: Individual functions allow the user to select their preferred bread, peanut butter, and jelly, displaying a numbered list for easier selection.
3. **Confirm Function**: Displays the user's selections for confirmation. The user can accept or reject their choices.
4. **Make Sandwich Function**: Orchestrates the flow of the program, calling each function in order. If the user confirms their choices, the program displays a message indicating that the sandwich is being made. If not, it restarts the process.
5. **Main Block**: The `if __name__ == "__main__":` block ensures that the program runs when executed directly.

Feel free to modify the options or the messages to customize the user experience further!