Advertisement
Guest User

python quiz thingy

a guest
Dec 11th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.98 KB | None | 0 0
  1. print("Hello, welcome to my quiz!")
  2.  
  3. name=input("Please enter your name to begin: ")
  4.  
  5. print("Welcome, " +name+ ", let's begin.")
  6.  
  7. print("This quiz contains 15 questions relating to python coding, each question will have one correct answer and there will be four options for each question.")
  8. print("The answers will be accepted as capital letters ONLY. The accepted input will be like this: 'A'")
  9.  
  10. print ('\n-----------------------------------------------------------\n')
  11.  
  12. # making the score and seting the score to zero
  13.  
  14. score=0
  15. score=int(score)
  16.  
  17. # time for the questions!
  18.  
  19. print("Question one: How do you get text to display in the output box correctly? (There will be ' instead of quotation marks)")
  20.  
  21. print("A. print(Like this)")
  22. print("B. input('Like this')")
  23. print("C. print('Like this')")
  24. print("D. input(Like this)")
  25.  
  26. Q1answer="C"
  27. Q1response=input("Your answer: ")
  28.  
  29. if(Q1response!=Q1answer):
  30. print("Incorrect")
  31. else:
  32. print("Correct! The answer is " +Q1response+ ".")
  33. score=score+1
  34.  
  35. print("Your current score is now " +str(score)+ " out of 15.")
  36. print ('\n-----------------------------------------------------------\n')
  37.  
  38. print("Question two: What does \ r do?")
  39.  
  40. print("A. It moves text to the right.")
  41. print("B. It moves text forward like the tab key.")
  42. print("C. It moves text down.")
  43. print("D. It moves text to the left.")
  44.  
  45. Q2answer="D"
  46. Q2response=input("Your answer: ")
  47.  
  48. if(Q2response!=Q2answer):
  49. print("Incorrect")
  50. else:
  51. print("Correct! The answer is " +Q2response+ ".")
  52. score=score+1
  53.  
  54. print("Your current score is now " +str(score)+ " out of 15.")
  55. print ('\n-----------------------------------------------------------\n')
  56.  
  57. print("Question three: What does a # with text in front of it do?")
  58.  
  59. print("A. It adds a comment")
  60. print("B. It adds plain text with no formatting")
  61. print("C. It makes the text italicized")
  62. print("D. It bolds the text")
  63.  
  64. Q3answer="A"
  65. Q3response=input("Your answer: ")
  66.  
  67. if(Q3response!=Q3answer):
  68. print("Incorrect")
  69. else:
  70. print("Correct! The answer is " +Q3response+ ".")
  71. score=score+1
  72.  
  73. print("Your current score is now " +str(score)+ " out of 15.")
  74. print ('\n-----------------------------------------------------------\n')
  75.  
  76. print("Question four: Which of the following is an assignment operator?")
  77.  
  78. print("A. @")
  79. print("B. $")
  80. print("C. =")
  81. print("D. &")
  82.  
  83. Q4answer="C"
  84. Q4response=input("Your answer: ")
  85.  
  86. if(Q4response!=Q4answer):
  87. print("Incorrect")
  88. else:
  89. print("Correct! The answer is " +Q4response+ ".")
  90. score=score+1
  91.  
  92. print("Your current score is now " +str(score)+ " out of 15.")
  93. print ('\n-----------------------------------------------------------\n')
  94.  
  95. print("Question five: How do you import a calendar?")
  96.  
  97. print("A. load calendar")
  98. print("B. start calendar")
  99. print("C. import calendar")
  100. print("D. input calendar")
  101.  
  102. Q5answer="C"
  103. Q5response=input("Your answer: ")
  104.  
  105. if(Q5response!=Q5answer):
  106. print("Incorrect")
  107. else:
  108. print("Correct! The answer is " +Q5response+ ".")
  109. score=score+1
  110.  
  111. print("Your current score is now " +str(score)+ " out of 15.")
  112. print ('\n-----------------------------------------------------------\n')
  113.  
  114. print("Question six: What does \ t do?")
  115.  
  116. print("A. It puts a tab of space behind text.")
  117. print("B. It moves text a line down.")
  118. print("C. It moves text to the left.")
  119. print("D. It adds a double quote.")
  120.  
  121. Q6answer="A"
  122. Q6response=input("Your answer: ")
  123.  
  124. if(Q6response!=Q6answer):
  125. print("Incorrect")
  126. else:
  127. print("Correct! The answer is " +Q6response+ ".")
  128. score=score+1
  129.  
  130. print("Your current score is now " +str(score)+ " out of 15.")
  131. print ('\n-----------------------------------------------------------\n')
  132.  
  133. print("Question seven: What does \ ' do?")
  134.  
  135. print("A. It moves text to the left.")
  136. print("B. It adds a double quote.")
  137. print("C. It moves text to the right.")
  138. print("D. It adds a single quote.")
  139.  
  140. Q7answer="D"
  141. Q7response=input("Your answer: ")
  142.  
  143. if(Q7response!=Q7answer):
  144. print("Incorrect")
  145. else:
  146. print("Correct! The answer is " +Q7response+ ".")
  147. score=score+1
  148.  
  149. print("Your current score is now " +str(score)+ " out of 15.")
  150. print ('\n-----------------------------------------------------------\n')
  151.  
  152. print("Question eight: Which of the following comparisons means 'equal to' in python?")
  153.  
  154. print("A. +=")
  155. print("B. ==")
  156. print("C. !=")
  157. print("D. =")
  158.  
  159. Q8answer="B"
  160. Q8response=input("Your answer: ")
  161.  
  162. if(Q8response!=Q8answer):
  163. print("Incorrect")
  164. else:
  165. print("Correct! The answer is " +Q8response+ ".")
  166. score=score+1
  167.  
  168. print("Your current score is now " +str(score)+ " out of 15.")
  169. print ('\n-----------------------------------------------------------\n')
  170.  
  171. print("Question nine: Which of the following comparisons means 'not equal to' in python?")
  172.  
  173. print("A. !=")
  174. print("B. ==")
  175. print("C. +=")
  176. print("D. -=")
  177.  
  178. Q9answer="A"
  179. Q9response=input("Your answer: ")
  180.  
  181. if(Q9response!=Q9answer):
  182. print("Incorrect")
  183. else:
  184. print("Correct! The answer is " +Q9response+ ".")
  185. score=score+1
  186.  
  187. print("Your current score is now " +str(score)+ " out of 15.")
  188. print ('\n-----------------------------------------------------------\n')
  189.  
  190. print("Question ten: Which of the following comparisons means 'greater than' in python?")
  191.  
  192. print("A. <=")
  193. print("B. >")
  194. print("C. >=")
  195. print("D. <")
  196.  
  197. Q10answer="B"
  198. Q10response=input("Your answer: ")
  199.  
  200. if(Q10response!=Q10answer):
  201. print("Incorrect")
  202. else:
  203. print("Correct! The answer is " +Q10response+ ".")
  204. score=score+1
  205.  
  206. print("Your current score is now " +str(score)+ " out of 15.")
  207. print ('\n-----------------------------------------------------------\n')
  208.  
  209. print("Question eleven: Which of the following comparisons means 'less than or equal to' in python?")
  210.  
  211. print("A. >")
  212. print("B. <=")
  213. print("C. =<")
  214. print("D. >=")
  215.  
  216. Q11answer="B"
  217. Q11response=input("Your answer: ")
  218.  
  219. if(Q11response!=Q11answer):
  220. print("Incorrect")
  221. else:
  222. print("Correct! The answer is " +Q11response+ ".")
  223. score=score+1
  224.  
  225. print("Your current score is now " +str(score)+ " out of 15.")
  226. print ('\n-----------------------------------------------------------\n')
  227.  
  228. print("Question twelve: Which of the following comparisons means 'greater than or equal to' in python?")
  229.  
  230. print("A. >=")
  231. print("B. >")
  232. print("C. <")
  233. print("D. =>")
  234.  
  235. Q12answer="A"
  236. Q12response=input("Your answer: ")
  237.  
  238. if(Q12response!=Q12answer):
  239. print("Incorrect")
  240. else:
  241. print("Correct! The answer is " +Q12response+ ".")
  242. score=score+1
  243.  
  244. print("Your current score is now " +str(score)+ " out of 15.")
  245. print ('\n-----------------------------------------------------------\n')
  246.  
  247. print("Question thirteen: Which of the following operators multiplies in python?")
  248.  
  249. print("A. /")
  250. print("B. x")
  251. print("C. *")
  252. print("D. +")
  253.  
  254. Q13answer="C"
  255. Q13response=input("Your answer: ")
  256.  
  257. if(Q13response!=Q13answer):
  258. print("Incorrect")
  259. else:
  260. print("Correct! The answer is " +Q13response+ ".")
  261. score=score+1
  262.  
  263. print("Your current score is now " +str(score)+ " out of 15.")
  264. print ('\n-----------------------------------------------------------\n')
  265.  
  266. print("Question fourteen: Which of the following operators makes an exponent in python?")
  267.  
  268. print("A. */")
  269. print("B. *+")
  270. print("C. *x")
  271. print("D. **")
  272.  
  273. Q14answer="D"
  274. Q14response=input("Your answer: ")
  275.  
  276. if(Q14response!=Q14answer):
  277. print("Incorrect")
  278. else:
  279. print("Correct! The answer is " +Q14response+ ".")
  280. score=score+1
  281.  
  282. print("Your current score is now " +str(score)+ " out of 15.")
  283. print ('\n-----------------------------------------------------------\n')
  284.  
  285. print("Question fifteen: Which of the following operators divides in python?")
  286.  
  287. print("A. /*")
  288. print("B. -+")
  289. print("C. /")
  290. print("D. *-")
  291.  
  292. Q15answer="C"
  293. Q15response=input("Your answer: ")
  294.  
  295. if(Q15response!=Q15answer):
  296. print("Incorrect")
  297. else:
  298. print("Correct! The answer is " +Q15response+ ".")
  299. score=score+1
  300.  
  301. print("Your current score is now " +str(score)+ " out of 15.")
  302. print("\nThank you for taking my quiz!\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement