Python – SoloLearn Intermediate Python Exceptions Else problem

This was confusing because the problem was called ‘else’ in the exception lessons, but it doesn’t even use else. Anyway I modified my completed code after a tiny bit with a list comprehension and some formatted prints. This could be worked on to complete an entire shopping cart system.

Yes I was fooling around with the menu items, so this is the ‘else’ problem modified.

# This cafe seems to be real gud

menu = [
    'Soggy Fries',
    'Turkey Sammich', 
    'Double Greaseburger', 
    'Grindy Coffee', 
    'Non Carbon Soda', 
    'Hot Yellow Beer', 
    'Chili con Kidneys', 
    'Anti Antacid', 
    'Stagnant Water'
full_menu = [str(menu.index(x) + 1) + '. ' + x for x in menu]
print('Piggy\'s Full Menu:\n', *full_menu, sep=' ')
    i = int(input('Enter item number 1 - {} to order it: '.format(len(menu))))
    print(menu[i - 1])
    print('Thanks for your order.')
    print('Item not found')
Piggy's Full Menu:
 1. Soggy Fries 2. Turkey Sammich 3. Double Greaseburger 4. Grindy Coffee 5. Non Carbon Soda 6. Hot Yellow Beer 7. Chili con Kidneys 8. Anti Antacid 9. Stagnant Water
Enter item number 1 - 9 to order it: 3
Double Greaseburger
Thanks for your order.

Leave a Comment