How to create the function is_burger(breads)that determines whether a stack of bread is a burger. Input :
View the step-by-step solution to:


How to create the function is_burger(breads) that determines whether a stack of bread is a


Input : a non-empty list of strings breads that represents the bread stack you are checking; the possible strings

are: 'ob', 'cb', 'ow', 'cw', 'or', 'cr'.

Output : a boolean, True if the bread stack is a burger; otherwise False . A bread stack is a burger if each

open piece of bread is followed by a matching closed piece of bread, and there is either nothing between

the opening and closing bread, or there is one or more burgers between the opening and closing bread.

Note: For a bread stack to be a burger it must follow two rules: first, any open piece of bread must be followed

by a matching closing piece of bread; second, any open-close pair may contain a stack of bread between them,

provided the stack is also a burger. There are three different kinds of bread: brioche (open brioche is 'ob' ,

closed is 'cb' ), wholemeal ('ow' , 'cw' ), and rye ('or' , 'cr' ).


Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes