OiO.lk Blog python Where/how do I store a list of items for a random item generator in Python?
python

Where/how do I store a list of items for a random item generator in Python?


So, I’m a beginner in Python development and I want to know not how to make a random number generator but how to make a random generator that chooses an item from a pre-existing list. When I google it, it always shows a list or a tuple with 4-5 items but what if I want a bigger list, like with 500 items?
Like I’ve seen movie title generators for example and I want to know, do I store the "titles" somewhere and then write a loop that will choose from the list or are the titles just under a number and the generator is just like any other random number generator but it returns the title to the user instead of the number?
Can I make a database with the items and then just pull the database up in code and make a regular random generator?
I’m just trying to learn more and have fun with Python.
Thanks in advance.

For now, I only did some research.



You need to sign in to view this answers

Exit mobile version