How to make a true or false quiz in python
I have created the following program in Python:
However, my output is as following:
But I want the following output:
What do I need to change in my code? asked May 15, 2020 at 18:49
1 Your question is missing a "(T/F) " string at the beginning, and a colon and space at the end.
answered May 15, 2020 at 18:54
Either update the question text to have the exact formatting you want:
Or update the
answered May 15, 2020 at 18:54
John GordonJohn Gordon 24.6k7 gold badges29 silver badges51 bronze badges Change:
to:
if you want the caller to be able to specify each question without the extra formatting pieces. answered May 15, 2020 at 18:54
SamwiseSamwise 57.9k3 gold badges29 silver badges38 bronze badges This time I made a quiz game, in which the player is asked questions and receives points for each question answered correctly. Some people told me I should learn about classes, so this is what I came up with.
How do I create a quiz in Python?Build a Quiz Application With Python. Demo: Your Python Quiz Application.. Project Overview.. Prerequisites.. Step 1: Ask Questions. ... . Step 2: Make Your Application User-Friendly. ... . Step 3: Organize Your Code With Functions. ... . Step 4: Separate Data Into Its Own File. ... . Step 5: Expand Your Quiz Functionality.. How do you make a yes or no in Python?how to make a yes or no question in python. def question():. i = 0.. while i < 2:. answer = input("Question? ( yes or no)"). if any(answer. lower() == f for f in ["yes", 'y', '1', 'ye']):. print("Yes"). break.. elif any(answer. lower() == f for f in ['no', 'n', '0']):. |