I am trying to do this
proverbs = "a bad excuse is better than none","A bad workman blames his tools," etc.
number_of_proverb = random.randint (1,38)
proverb = sentence number number_of_proverb
But I have no idea how to assign numbers to sentences. Thank you, beforehand, for all of your help.
PS 38 because there are 38 sentences. Also is this
proverbs = "something something","something something","something, something"
correct? Sorry for these basic questions but I just started.
I see what you are trying to do. You are making a list of proverbs and you want to randomly select one from a list. So it would be best to store your proverbs in a list and use random.choice
to select them from that list.
proverbs = ["this proverb","that proverb","something, something", "another"]
random.choice(proverbs)
If you want to have a number associated with the proverbs, you can just use the index
function to get the position of the proverb in the list. Like this:
proverbs.index("another")
Output:
3