Oct-15-2020, 11:42 AM
here
import sys print("**********************") print("*welcome to QuizWorld*") print("**********************") print(" v.1.0.0 ") print("rules: Do not cheat each answer will give you 5 points, if you get more then 15 points you win if you get less you loose, after you win or lose go check out your answers and final points on lista risultati or punteggio finale") def yes(): a = input("do you want to play? ") if a == "yes": del a print("ok, so first question") print("whats the capital of italy?") a = input("answer: ") if a == "rome": print("correct") a1 = 5 with open("lista risultati.txt", 'w') as f: f.write(str(a1\n)) else: a1 = 0 print("wrong") with open("lista risultati.txt", 'w') as f: f.write(str(a1\n)) f.close print("second question") print("1*2*3*4*5*6*7*8*9*0*1*1*0*1") b = input("answer: ") if b == 0: print("correct") b1 = 5 with open("lista risultati.txt", 'w') as f: f.write(str(b1\n) else: b1 = 0 print("wrong") with open("lista risultati.txt", 'w') as f: f.write(str(b1\n) f.close print("third question") print("does it weight more 1 pound of steel or 1 pound of feathers") c = input("answer: ") if c == "they weight the same": print("correct") c1 = 5 with open("lista risultati.txt", 'w') as f: f.write(str(c1\n)) else: c1 = 0 print("wrong") with open("lista risultati.txt", 'w') as f: f.write(str(c1\n) f.close print("FINAL question") print("is this program good?") d = input("answer: ") if d == "yes": print("correct") d1 = 5 with open("lista risultati.txt", 'w') as f: f.write(str(d1)) else: d1 = 0 print("wrong") with open("lista risultati.txt", 'w') as f: f.write(str(d1)) f.close e = a1 + b1 + c1 + d1 with open("risultato finale.txt", 'w') as f1: f1.write(str(e) f1.close r = open("risultato finale.txt", "r") if r == 15: print("testing results...") print("BRAVO, you have winned the game") else: print("testing results...") print("you have lost the game") elif a == "no": sys.exit("you said to do it") else: print("!!ERROR: you need to enter yes or no. !!") yes() yes()