1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sauron [17]
3 years ago
13

*Python Coding

Computers and Technology
1 answer:
Reika [66]3 years ago
4 0

correct = (["1.B", "6.A", "11.B", "16.C","2.D", "7.B", "12.C", "17.C", "3.A", "8.A", "13.D", "18.B","4.A" ,"9.C", "14.A", "19.D","5.C", "10.D", "15.D", "20.A"])

f = open("MyFile.txt", "r")

user_answers = ([])

count = 0

txt = ""

for x in f.read():

   if x == " " or x == "\n":

       x = ""

       count += 1

   if count == 2 :

       user_answers.append(txt)

       txt = ""

       count = 0

   txt += x

i = 0

cor = 0

wrong = ([])

while i < len(correct):

   if correct[i] == user_answers[i]:

       cor += 1

   else:

       wrong.append(user_answers[i])

   i += 1

questions = ([])

for i in wrong:

   txt = ""

   for w in i:

       if w == ".":

           questions.append(int(txt))

       txt+=w

print("There were {} correct answers".format(cor))

print("There were {} incorrect answers".format(len(questions)))

print("The incorrectly answered questions are {}".format(questions))

f.close()

The file I used for testing looks like:

1. C 6. A 11. B 16. C

2. D 7. B 12. C 17. C

3. A 8. D 13. D 18. D

4. A 9. C 14. A 19. A

5. C 10. D 15. D 20. C

The code only works if there is a new line after 20. C (press enter after that question if a new line isn't already included)

I hope this helps!

You might be interested in
A _____ is a type of legal protection for which person can apply to protect an invention or a discovery.
shepuryov [24]

Answer:

patent

Explanation:

A patent is an intellectual property, with this legal protection, we can exclude to use, sell, and importation of an invention for a limited period of years, but we must do an enabling public disclosure of the invention or discovery, it is a requirement of the patent law, a patent is considered an advantage in the industries world.

3 0
3 years ago
1. List 2 items that are included as administrative information in a health record.
sleet_krkn [62]

Administrative, Billing data and progress notes. Also Patient Demographics.

6 0
4 years ago
Mellissa wants to pursue a career in database administration. Select the requirements needed to achieve this.
adelina 88 [10]
I think its the answer is 4 
8 0
4 years ago
Read 2 more answers
Sets of keywords and symbols that help refine internet search requests are called _____. boolean operators microsoft operators a
Kay [80]
Boolean operators, it uses the word "and","or" and "not" with keywords to control the search. For example if you search for health and food, the search engine will give a narrow search focusing on the two keywords. Using "or" with keywords will give much broader results. Using a "not" will remove one keyword from the search, ex. windy not rainy will give results of the keyword windy only. An asterisk on the other hand, gives wider results with variations.
3 0
3 years ago
Which of the following statements describes a work station?
STALIN [3.7K]

Answer:

B) Single-user computer which has a more powerful microprocessor than personal computers

8 0
3 years ago
Other questions:
  • To use the Save As command, click on the __________tab to open the backstage view.
    13·1 answer
  • Which method of deleting files can be used in windows xp and vista?
    12·1 answer
  • What is one way to maintain Internet safety? a) avoid interacting with people on the Internet. B) avoid giving out information a
    7·1 answer
  • Is a book considered technology?
    8·2 answers
  • Suppose the price of a complement to LCD televisions falls. What effect will this have on the market equilibrium for LCD​ TVs? T
    13·1 answer
  • Carbon copy others who are..
    14·2 answers
  • What would be an ideal scenario for using edge computing solutions?
    10·1 answer
  • Assume there is an interactive math tutor. Many students take the math lessons online. At the end of each lesson, students have
    5·1 answer
  • Presentations must have what to be efffective
    8·1 answer
  • Question 12 (5 points)
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!