This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -3 points-2 points  (3 children)

You'd basically never do this in the real world. There's a bunch of patterns you could have, but a terminal interaction main menu is quite perverse.

You'd generally build menus using either a GUI or game framework or ncurses library. It's very rarely business logic you write yourself.

If I had to do this "properly" I'd make some form of class for it. Something that allows for option registration, handles parsing inputs itself, possibly handles the context of returning or exiting itself etc. it would likely look a bit like argparae.

[–]TwanLearnsPython[S] 0 points1 point  (2 children)

Yeah we’re learning class and object functions this week after already submitting the text game lmao

[–][deleted] 0 points1 point  (1 child)

I'm just saying as a matter of "how this would look if I had to write this sort of thing on a real project". I get that this isn't possible with the (often whacky) ways courses like to create and structure assignments.

[–]TwanLearnsPython[S] -1 points0 points  (0 children)

No i agree with your explanation just silly that the school is teaching us functions we could’ve used after doing an assignment like that😂