mardi 2 février 2021

How do I randomly select a variable from a list, and then re assign it to another variable?

i want to make a mastermind game im sure you all know what it is, some kind of gcse style python number guessing game. it should ask you for a number, select a number nad then tell you if you guessed any correctly but im having trouble assignign that randomly selected number to "x" perhaps. im pretty new to python as you can see

numberseasy = ['1244', '1354', '2355', '2366', '2609', '0010', '1234', '8873', '7775', '2512', '0293', '9463', '9901',
               '6272', '0629']
numbershard = ['25356', '86025', '67390', '96873', '01255', '77654', '96756', '88742', '09564', '12345', '19455',
               '35656', '20967', '32570']

print("welcome to mastermind!")
gamemode = input("please select gamemode: easy, hard")
if gamemode == "easy":
    (random.choice(numberseasy)) = x
    print("easy was selected")
    print("im thinking of a number, try to guess a one digit integer each time to work out the number im thinking of i")
    print("will tell you if you have one correct")
    first = input("please enter a number")




Aucun commentaire:

Enregistrer un commentaire