Skip to content
Advertisement

Python psychic guessing game repeats 10 times

I want it so it will randomly generate a number between 1-10 and the user will input their guess. It will then output if it is right or wrong, after 10 rounds it will tell them how psychic they are. I have done most of it but I cannot get it to randomly generate 10 numbers instead it generates 1 number and you can just input that number and get it correct every time if you find that number

JavaScript

Advertisement

Answer

You need to put the random=(random.randint(1,10)) inside the for loop for it to change with every loop:

JavaScript

Then the rest of the code

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement