Guest User

Untitled

a guest
Nov 29th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. #lines 4 through 21 contains my questions and answers
  2.  
  3. easy_questions= ["""What is 20 + 2?__1__", "What is the capital of Georgia?__2__","If john has $4 and buys a candy bar for $3.50, how much money does he have left over?__3__",
  4. "What is the name of the NBA basketball team in Georgia?__4__","What is the name of the NFL team in Georgia?__5__",
  5. "How many toys do I have if I sell 3, but had 8 toys originally?__6__","How many Bad Boy movies are there?__7__",
  6. "How many Fast Furious movies are there?__8__","What is 10 * 5?__9__","What city does the UGA team play in?__10__"""]
  7.  
  8. medium_questions= ["""What is 20 * 2?__1__", "What is 100 * 2?__2__", "Who was the first Black President?__3__"," Who was the first president of the USA?__4__",
  9. "Where is Lebron James from (Hometown)?__5__", "1*1?__6__", "30*1000?__7__", "5 - 10?__8__",
  10. "How many home alone movies are there?__9__","Who is the head coach of the Atlanta Falcoms? ___10____"""]
  11.  
  12. hard_questions= ["How many wheels do normal cars have?___1___","What city is disney world located in Florida?___2___","What type of dog was Balto in the movie?___3___",
  13. "Did the Rock ever play college football (yes or no)?____4___","how many best man movies are there?____5____",
  14. "What type of dog was lassie?____6____","100 + 100?___7___", "40+40?____8____",
  15. "What is the name of the team that Greg Popovich coaches?___9___", "What is the name of the football team in Atlanta?____10____"]
  16.  
  17.  
  18. easy_answers= ["22", "atlanta", ".50", "atlanta hawks", "atlanta falcons" ,"five", "two", "eight" , "50", "athens"]
  19. medium_answers= ["40", "200", "barack obama","george washington","akron ohio","1","30000","-5","4","dan quin"]
  20. hard_answers= ["4", "orlando", "husky", "yes","2","collie","200","80","Spurs","Atlanta Falcons"]
  21.  
  22.  
  23. #Lines 25 through 36 contains a dictionary which complies all my questions and answers.
  24. #This makes everything easier to read in my opinion
  25. question_guide = {
  26. "easy":{
  27. "answers":easy_answers,
  28. "questions": easy_questions
  29. },
  30. "medium":{
  31. "answers":medium_answers,
  32. "questions": medium_questions
  33. },
  34. "hard":{
  35. "answers":hard_answers,
  36. "questions": hard_questions
  37. }
  38. }
  39.  
  40. def play_python_quiz():
  41. from datetime import datetime
  42. now = datetime.now()
  43. print("Today's Date is:")
  44. print('%s/%s/%s' % (now.month, now.day, now.year))
  45. print("")
  46. print('Hello welcome to my Quiz, what is your name?')
  47. usersname = input()
  48. print ("")
  49. print('It is nice to meet you, ' + usersname)
  50. select_level()
  51.  
  52. def quiz(questions, answers):
  53. score = 0
  54. num_answers = None
  55. for i, question in enumerate(questions):
  56. print("{}) {}".format(i+1, question))
  57. answer = input("Please fill in the blank with your answer below:n")
  58. if answer.lower() == answers[i].lower():
  59. score += 1
  60. return score, len(answers)
  61.  
  62. questions = question_guide[select_level.lower()]["questions"]
  63. answers = question_guide[select_level.lower()]["answers"]
  64. score, num_answers = quiz(questions, answers)
  65.  
  66. print("Your score is {}/{}".format(score, num_answers))
  67.  
  68.  
  69.  
  70. def select_level(): #Inputs easy, medium or hard. Output, Relevant questions and answers.
  71. select_level = input("Select your difficulty level. easy | medium | hard")
  72. while select_level not in ["easy", "medium", "hard"]:
  73. select_level = input("Please follow instructions and try again")
  74. print ("game_questions[select_level]")
  75. return select_level
  76.  
  77.  
  78. play_python_quiz()
  79.  
  80. questions = question_guide[select_level.lower()]["questions"]
Add Comment
Please, Sign In to add comment