Python beginner's project (Quiz Game) - Covid-19 - 04-25-2022 Code: # text based Quiz Game # making a variable to store total marks marks = 0 # Greet the user if he/she wants to play answer = input("Do you want to play? ") if answer.lower() == 'yes': print("Let's Start the game") else: print("Ok come back next time!") exit() # Asking the first question answer = input("Who invented the BALLPOINT PEN? ") # lower() coverts the each alphabet # of string into lower case if answer.lower() == 'biro brothers': print("Correct") # if user give correct answer increment marks by 1 marks += 1 else: print("Incorrect") answer = input("What J. B. Dunlop invented? ") if answer.lower() == 'pneumatic rubber tire': print("Correct") marks += 1 else: print("Incorrect") answer = input("What Galileo invented? ") if answer.lower() == 'thermometer': print("Correct") marks += 1 else: print("Incorrect") answer = input("This English inventor is known as the 'Father of Computing.' ") if answer.lower() == 'charles babbage': print("Correct") marks += 1 else: print("Incorrect") answer = input("For whom high heeled shoes were invented? ") if answer.lower() == 'King Louis': print("Correct") marks += 1 else: print("Incorrect") # Decisions based on marks if marks < 2: print("Try again") # elif short for if else elif marks <= 3: print("You tried better") elif marks > 3: print("Good job you did it Congrats") # Printing the percentage of correct answers print("You got " + str((marks/5) * 100) + "% marks")
"Keep Good care of your Health Allah Hafiz and Good Bye Till the next post" "Keep Learning and Keep exploring" RE: Python beginner's project (Quiz Game) - Mr.Kurd - 04-26-2022 I think, if we could have an image of the game processed would be nice and make mkre sence RE: Python beginner's project (Quiz Game) - Covid-19 - 04-26-2022 (04-26-2022, 07:41 PM)Mr.Kurd Wrote: I think, if we could have an image of the game processed would be nice and make mkre sence Ok I'll edit it. Thanks for your suggestion. |