prabhavms

Q4(cyclesheet 6)

Dec 27th, 2021 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. answers = "A\nB"
  2. file = open('answers.txt', 'w')
  3. file.write(answers)
  4. file.close()
  5. def quiz(a,b):
  6.     count = 0
  7.     j = []
  8.     with open("answers.txt","r") as answers_file:
  9.         for i in answers_file:
  10.             options = i.strip()
  11.             j.append(options)
  12.     if j[0] == a and j [1] == b:
  13.         count  = 100
  14.     elif j[0] != a and j[1] == b:
  15.         count = 50
  16.     elif j[0] == a  and j[1] != b:
  17.         count = 50
  18.     else:
  19.         count = 0
  20.     print(count)
  21. a = input()
  22. b = input()
  23. quiz(a,b)
  24.    
Add Comment
Please, Sign In to add comment