Jul-05-2018, 11:47 PM
is there any problems in this code, because it says invalid syntax
also i have another problem , and it is i want to run the code again after i answer the questions. but if the random.randint generates the same number as the one that is already asked, it will generate another one. how to achieve this? thanks!
question1 = input("Question!") answer1 = input("Answer of question1") question2 = input("Question!") answer1 = input("Answer of question2") import random random = random.randint(1,2) if random = 1: playeranswer1 = input(question1) if playeranswer1 = answer1: print("you are right") else: print("you are wrong") else: playeranswer2 = input(question2) if playeranswer2 = answer2: print("you are right") else: print("you are wrong")also i want to make a question generator that generates random questions from google. is there any way to connect python to google? and is there any way for me to search google through python code?
also i have another problem , and it is i want to run the code again after i answer the questions. but if the random.randint generates the same number as the one that is already asked, it will generate another one. how to achieve this? thanks!