mercredi 4 mars 2020

Python randomising questions

Hello guys i need some help with python im currently building a quiz but i dont know how to make my python randomise the questions

name = input("What is your name? ")
print("Hello, "+name+".You will Try my quiz today lets get started")
score = 0
counter = 0
while counter<2:

    answers = input("When did covid-19 outbreak? \n a.2008 \n b.2018 \n c.2020")
    if answers == "c":
        print("Correct!")
        score += 1
    else:
        print("That is incorrect.")
        counter = counter +1
    print ("The correct answer is C")
    answers = input("What is the most dangerous animal? \n a.cape buffalo \n b.black mamba \n c.box jellyfish")
    if answers == "c":
        print("correct")
        score += 1
    else:
        print ("That is incorect.")
        counter = counter +1
    print ("The correct answer is c")
    answers = input("How old was kobe bryant \n a.41 \n b.45 \n c.40")
    if answers == "a":
        print ("correct")
        score +=1
        if score == 3:
            answer = input("How old is a 5 year old baby? \n a.6 \n b.50 \n c.7")
            if answer =="5":
                print("correct")
                score +=1
    else:
        print ("That is incorect.")
        counter = counter +1
        print ("The correct answer is a")
    answers = input("who is trenyce's celebrity crush \n a.gordon ramsey \n b.Michael B Jordan \n c.kobe bryant")
    if answers == "b":
        print ("correct")
        score +=1
        if score == 5:
            answer = input("A cowboy rode into town on Friday. He stayed in town for three days and rode out on Friday. What is the horses name?")
            if answer =="Friday":
                print ("correct your doing really well")
                score +=1
    else:
        print("That is not correct")
        counter = counter +1
        print("the correct answer is b")
    answers = input("who is playing in the next fast and furious? \n a.Mark William Galaway \n b.John Felix Anthony Cena Jr \n c.Gordon Ramsey")
    if answers == "b":
        print("correct")
        score +=1
    else:
        print("That is not correct")
        counter = counter +1
        print ("The correct answer is b")
    print("You have")
    print(score)    
    print("points")
    playagain = input ("would you like to play again? \n a=yes \n b=no")
    if playagain == "a":
        print ("continue")
    else:
        print ("bye")
        break

this is what i have got but i want python to randomise the questions do i dont want it to start with when did covid-19 outbreak i want the questions to always be randomised except for the one with the cowboy and the baby




Aucun commentaire:

Enregistrer un commentaire