mercredi 21 octobre 2015

random.choice in python help me

I have to generate a maths question at random. I have managed to use random.choice(list1) to generate these numbers but when I try to get the operation symbol, it doesn't work. I put random.choice("+x-")

and it works but only ever chooses the first symbol in the brackets (+). Do I have to put them in separate speech marks?. Like...

random.choice("+", "-", "x")




Aucun commentaire:

Enregistrer un commentaire