generate a random t-shirt size from xs through xl for my story in python

To generate a random t-shirt size from xs through xl in Python, you can define a list containing the different sizes and then use the random module to randomly choose one of the sizes from the list. Here's an example function to do this:

main.py
import random

def random_tshirt_size():
    sizes = ["XS", "S", "M", "L", "XL"]
    return random.choice(sizes)
113 chars
6 lines

You can then call this function whenever you need to generate a random t-shirt size:

main.py
size = random_tshirt_size()
print("Your randomly generated t-shirt size is:", size)
84 chars
3 lines

This will output something like:

main.py
Your randomly generated t-shirt size is: M
43 chars
2 lines

gistlibby LogSnag