Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- name = input("What is your name? \n")
- age = input("How old are you? \n")
- sex = input("What is your gender? \n")
- general_culture_questions = 'General Questions'
- animals_questions = 'Animals Questions'
- capitals_questions = 'Capitals Questions'
- math_questions = 'Math Questions'
- geography_questions = 'Geography Questions'
- logical_questions = 'Logical Questions'
- score=0
- questions = [general_culture_questions, animals_questions, capitals_questions, math_questions, geography_questions, logical_questions]
- print(f"Hello {name}. Good Luck!")
- print ("Are you ready to begin?")
- input ("Press Enter when you are ready to begin...")
- print("Welcome to the General Culture Questions Quiz 1")
- time.sleep(3)
- print ("Note: You must answer using A, B, C or D")
- time.sleep(3)
- print (" ")
- class Question:
- def __init__(self, prompt, answer):
- self.prompt = prompt
- self.answer = answer
- question_prompts = [
- "Q1: How many days are there in a normal year?\n(a) 365\n(b) 366\n(c) 362\n(d) 368\n\n",
- "Q2: Which month of the year has the least number of days?\n(a) June\n(b) February\n(c) July\n(d) May\n\n",
- "Q3: How many weeks are there in one year?\n(a) 51\n(b) 54\n(c) 53\n(d) 52\n\n",
- "Q4: Which is the nearest star to planet earth?\n(a) Sun\n(b) Moon\n(c) Mars\n(d) Jupiter\n\n",
- "Q5: Which day is observed as World Environment Day?\n(a) 5 July\n(b) 2 August\n(c) 5 June\n(d) 12 September\n\n",
- "Q6: Who invented the Computer?\n(a) Mark Zuckerberg\n(b) Bill Gates\n(c) Steve Jobs\n(d) Charles Babbage\n\n",
- "Q7: How many teeth does a healthy adult have including the wisdom teeth?\n(a) 32\n(b) 34\n(c) 30\n(d) 33\n\n",
- "Q8: How many strings does a violin have?\n(a) 6\n(b) 8\n(c) 4\n(d) 12\n\n",
- "Q9: How many planets are there in our solar system?\n(a) 8\n(b) 6\n(c) 10\n(d) 9\n\n",
- "Q10: How many days are there in the month of February in a leap year?\n(a) 28\n(b) 29\n(c) 30\n(d) 27\n\n",
- ]
- questions = [
- Question(question_prompts[0], "a"),
- Question(question_prompts[1], "b"),
- Question(question_prompts[2], "a"),
- Question(question_prompts[3], "d"),
- Question(question_prompts[4], "c"),
- Question(question_prompts[5], "d"),
- Question(question_prompts[6], "a"),
- Question(question_prompts[7], "c"),
- Question(question_prompts[8], "a"),
- Question(question_prompts[9], "a"),
- ]
- def run_quiz(questions):
- score = 0
- for question in questions:
- answer = input(question.prompt)
- if answer == question.answer:
- score += 1
- print("you got", score, "out of", len(questions))
- run_quiz(questions)
- score=int()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement