r/learnpython • • 12m ago

Little fun code I put together:)

Hi! So I've been learning code for a little while now and lately, I've been getting more ideas for little programs to put together. They're not really useful in practical sense, but they're still fun exercises and ways to challenge myself while I'm still learning and understanding the basics.

I just thought this one would be fun to share because it took me a second to figure out the best way to have both lists be printed at the same time. Honestly though, I don't know why I didn't think of just doing a function right away though HSDH

The basic idea of the program is to generate a full breakfast by randomly choosing an entree and a side to go with it!

import random

entree_list = ["eggs", "cereal", "waffles", "oatmeal"]

side_dish = ["hashbrowns", "toast", "orange", "banana", "yogurt"]

def breakfast_run():
    print("Get someeeeeee")
    print(random.sample(entree_list, k=1))
    print("and")
    print(random.sample(side_dish, k=1))

print(breakfast_run()
0 Upvotes

0 comments sorted by