stage.set_background("schoolhallway") lboy = codesters.Sprite("person3") lboy.go_to(0, -110) lboy.say("Let's take a short quiz.",5,"Yellow",20) numcorr = 0 q1 = lboy.ask("What web-based programming environment has a mascot of a cat and recently celebrated its 10th birthday?") q1=q1.lower() stage.wait(1) if q1 == "scratch": numcorr = numcorr + 1 lboy.say("You are correct! Scratch is the environment and the mascot.",5,"Yellow",20) else: lboy.say("I'm sorry. That is incorrect. Scratch is the environment and the mascot.",5,"Yellow",20) stage.wait(1) q2 = lboy.ask("What markup language is used primarily to create web pages?") q2=q2.lower() stage.wait(1) if q2 == "html": numcorr = numcorr + 1 lboy.say("You are correct! HTML or HyperText Markup Language is used to create webpages.",5,"Yellow",20) elif q2 == "hypertext markup language": numcorr = numcorr + 1 lboy.say("You are correct! HTML or HyperText Markup Language is used to create webpages.",5,"Yellow",20) elif q2 == "hyper-text markup language": numcorr = numcorr + 1 lboy.say("You are correct! HTML or HyperText Markup Language is used to create webpages.",5,"Yellow",20) elif q2 == "hyper text markup langugage": numcorr = numcorr + 1 lboy.say("You are correct! HTML or HyperText Markup Language is used to create webpages.",5,"Yellow",20) else: lboy.say("I'm sorry. This is incorrect. HTML or HyperText Markup Language is used to create webpages.",5,"Yellow",20) stage.wait(1) q3 = lboy.ask("What movie that came out in early 2017 tells the story of 3 African American women who were the first women engineers at NASA Langley?") q3=q3.lower() stage.wait(1) if q3 == "hidden figures": numcorr = numcorr + 1 lboy.say("You are correct! Hidden Figures tells the story of the first 3 African American women engineers at NASA.",5,"Yellow",20) else: lboy.say("I'm sorry. This is incorrect. Hidden Figures tells the story of the first 3 African American women engineers at NASA.",5,"Yellow",20) stage.wait(1) lboy.say("Let's see how you did overall.",5,"Yellow",20) if numcorr == 3: lboy.say("Awesome! You got 100%! W00t!",5,"Yellow",20) elif numcorr == 2: lboy.say("Not bad! You got 2 out of 3 correct.",5,"Yellow",20) elif numcorr == 1: lboy.say("You got 1 out of 3 correct. Time to brush up on your trivia a little",5,"Yellow",20) else: lboy.say("I'm sorry you didn't get any correct. I hope you'll try again.",5,"Yellow",20)
  • Run Code
  • Show Console
  • Codesters How To (opens in a new tab)