Skip to content

Using inputs and loops #1

Description

@akumprosper

7-8 & 7-9: Deli and No Pastrami

sandwich_orders = [
'tuna',
'pastrami',
'ham',
'pastrami',
'veggie',
'pastrami',
'chicken'
]

finished_sandwiches = []

Inform customers that pastrami is unavailable

print("Sorry, the deli has run out of pastrami.\n")

Remove all occurrences of 'pastrami'

while 'pastrami' in sandwich_orders:
sandwich_orders.remove('pastrami')

Make the remaining sandwiches

while sandwich_orders:
current_sandwich = sandwich_orders.pop(0)
print(f"I made your {current_sandwich} sandwich.")
finished_sandwiches.append(current_sandwich)

List all finished sandwiches

print("\nSandwiches that were made:")
for sandwich in finished_sandwiches:
print(f"- {sandwich}")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions