r/learnpython • • 4h ago

Little fun code I put together:)

Edit: I fixed the last line in the program, just had an issue when pasting it and didn't think when I filled it back in. Thank you guys for letting me know!

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))

breakfast_run()
0 Upvotes

5 comments sorted by

5

u/ninhaomah 4h ago

" print(breakfast_run()"

Have you tried running it ? Aren't you missing something ? Or copy/paste issue ?

1

u/V0xter 3h ago

OH oops sorry I don't know why I wrote that Yeahhh it was a copy/paste issue, I just spaced out when I filled it back in HSHDH lemme fix that

4

u/smichaele 3h ago

This definitely won’t run as shown.

0

u/V0xter 3h ago

Aghhh yeah I just had a copy/past issue and it didn't put in the last line, and I spaced out when I put it back in HSHD

1

u/SnooHedgehogs52 2h ago

I like it, it’s cute.

Great work homie!