[Tutor] Hi Tutor

yehudak . katye2007 at gmail.com
Sat Jan 9 16:16:22 EST 2016


I wrote this short program for my grandson:

from random import sample

soups = ['Onion soup', 'Veggie soup', 'Chicken soup', 'Corn soup']
salads = ['Veggie', 'Onion', 'Cabbage', 'Lettuce', 'Caesar', 'Tomato']
main = ['Crab cake', 'Catfish', 'Ribs', 'Chopped liver', 'Meat balls']
beverage = ['Wine', 'Rum', 'Lemonade', 'Red bull', 'Margarita', 'Jin']

def dish(soups):
    return (sample(soups, 1))

print('Soup:\t\t', dish(soups))
print('Salad:\t\t', dish(salads))
print('Main dish:\t', dish(main))
print('Beverage:\t', dish(beverage))

A possible output could be:

Soup: ['Chicken soup']
Salad: ['Caesar']
Main dish: ['Meat balls']
Beverage: ['Wine']

How do I get rid from the square brackets and the quotation marks in the
output?

Thank you.


More information about the Tutor mailing list