Question

PYTHON Driver’s License The local driver’s license office has asked you to create an application that...

PYTHON

Driver’s License

The local driver’s license office has asked you to create an application that grades the written portion of the driver’s license. The paper has 20 multiple-choice questions. Here are the correct answers:

  1. A
  2. C
  3. A
  4. A
  5. D
  6. B
  7. C
  8. A
  9. C
  10. B
  11. A
  12. D
  13. C
  14. A
  15. D
  16. C
  17. B
  18. B
  19. D
  20. A

Your program should store these correct answers in a list. The program should read the student’s answers for each of the 20 questions from a text file and store the answers in another list. (Create your own text file to test the application.) After the student’s answers have been read from the file, the program should display a message indicating whether the student pass or failed. (A student must correctly answer 15 of the 20 questions to pass.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions.

Homework Answers

Answer #1

Hey mate, the Python code for above program is provided below with sample output. Do refer the screenshot of the code for proper indentation and error free execution.

SAMPLE TEXT FILE ( that stores student's answers ) -

MAIN PROGRAM -

# list of correct answers
correct_Answers=['A','C','A','A','D','B','C','A','C','B','A','D','C','A','D','C','B','B','D','A']

# opening text file that stores student's answers 
txtFile=open("answers.txt")

i=0
marks=0
student_Answers=list()
incorrect_Answers=list()

# reading student's answers from student.txt and storing in separate list
for line in txtFile:
    student_Answers.append(line.strip())

# validating the answers in each list and storing question numbers of incorrect answers in separate list
for answer in student_Answers:
    if(answer==correct_Answers[i]):
        marks=marks+1
    else:
        incorrect_Answers.append(i+1)
    i=i+1

# printing overall result    
if(marks>=15):
    print("\nResult: Student is Passed!")

else:
    print("\nResult: Student is Failed!")

print("\nTotal number of correctly answered questions: ",marks)
print("Total number of incorrectly answered questions: ",(20-marks))
print("List of question numbers answered incorrectly: ",incorrect_Answers)

# closing the file to free up memory space
txtFile.close()

OUTPUT -

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
--USING C# ONLY-- You will create your own on-line shopping store in the console application. You...
--USING C# ONLY-- You will create your own on-line shopping store in the console application. You can choose different products to sell in your store (at least 8 products). You will create an product inventory text file. The program will display two options at the beginning of the program, Customer and Manager. Customer: If this is a new customer, the program will allow the customer to register with their information and assign a unique ID number to the new customer....
A quiz consists of 15 multiple-choice questions. Each question has 5 choices, with exactly one correct...
A quiz consists of 15 multiple-choice questions. Each question has 5 choices, with exactly one correct choice. A student, totally unprepared for the quiz, guesses on each of the 15 questions. a. How many questions should the student expect to answer correctly? b. What is the standard deviation of the number of questions answered correctly? c. If at least 7 questions must be answered correctly to pass the quiz, what is the chance the student passes?
A group of statisticians at a local college has asked you to create a set of...
A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set of numbers, as defined in Section 5.4. Define these functions in a module named stats.py. Also include a function named mean, which computes the average of a set of numbers. Each function should expect a list of numbers as an argument and return a single number. Each function should return 0 if the list...
A teacher gives a student a make-up test consisting of 20 true-false questions. The intent of...
A teacher gives a student a make-up test consisting of 20 true-false questions. The intent of the test is to determine whether the student answers the questions correctly through knowledge of the material or merely by making lucky guesses. Assume the correct answers are a random sequence of “true” and “false” and that the student’s guesses are also random. a. State a null hypothesis based on the probability of guessing the correct answer to a question. b. State a one-tailed...
Please create a python module named homework.py and implement the functions outlined below. Below you will...
Please create a python module named homework.py and implement the functions outlined below. Below you will find an explanation for each function you need to implement. When you are done please upload the file homework.py to Grader Than. Please get started as soon as possible on this assignment. This assignment has many problems, it may take you longer than normal to complete this assignment. This assignment is supposed to test you on your understanding of reading and writing to a...
Due to pressing social commitments, a student, was not able to study for an examination. The...
Due to pressing social commitments, a student, was not able to study for an examination. The examination consists of 4 multiple choice questions. Each question has 6 possible answers from which to choose, only one of which is correct. The student plans to answer the questions randomly by rolling a fair die for each question and choosing the response associated with the number rolled. Let X denote the number of questions correctly answered by the student. a)      What is the probability...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may be given a list of raw email addresses and be asked to generate meaningful information from such a list. This project involves parsing such a list and generating names and summary information from that list. The script, eparser.py, should: Open the file specified as the first argument to the script (see below) Read the file one line at a time (i.e., for line in...
C# Step 1: Create a Windows Forms Application. Step 2: Create a BankAccount class. Include: Private...
C# Step 1: Create a Windows Forms Application. Step 2: Create a BankAccount class. Include: Private data fields to store the account holder's name and the account balance A constructor with 0 arguments A constructor with 1 argument (account holder's name) A constructor with 2 arguments(account holder's name and account balance) Public properties for the account holder's name and the account balance. Do not use auto-implemented properties. A method to increase the balance (deposit) A method to decrease the balance...
A student is taking a multiple-choice quiz in which each question has five possible answers, exactly...
A student is taking a multiple-choice quiz in which each question has five possible answers, exactly one of which is correct. He knows 85% of the material being tested. Assume the teacher has chosen the questions independently and at random from among all the questions she could have chosen. When the student knows the correct answer to a given question, he has a 98% chance of marking it correctly. When he does not know the answer, he answers by marking...
Part 1 - LIST Create an unsorted LIST class ( You should already have this code...
Part 1 - LIST Create an unsorted LIST class ( You should already have this code from a prior assignment ). Each list should be able to store 100 names. Part 2 - Create a Class ArrayListClass It will contain an array of 27 "list" classes. Next, create a Class in which is composed a array of 27 list classes. Ignore index 0... Indexes 1...26 correspond to the first letter of a Last name. Again - ignore index 0. index...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • How can you use Bayes’ theorem in light of new information? In Bayes’ theorem, how does...
    asked 2 minutes ago
  • Which of the following is not one of the four states of a working file? Unchanged,...
    asked 5 minutes ago
  • Assume we have CPU instructions that look like this: load register, address save register, address Where...
    asked 18 minutes ago
  • What is the difference between the following two declarations? char array[] = “Hello World”; char *array...
    asked 34 minutes ago
  • Discuss knowledge and understanding gleaned from The Least Dangerous Assumption and Strategies for Presuming Competence. How...
    asked 34 minutes ago
  • Exercise 13-20 (LO13-3) The owner of Maumee Ford-Volvo wants to study the relationship between the age...
    asked 36 minutes ago
  • Scenario The Department of Administrative Services (DAS) provides a number of services to other departments in...
    asked 44 minutes ago
  • Linear Regressions The number of newly reported crime cases in a county in New York State...
    asked 49 minutes ago
  • Specialty courts have been developed for various categories of crimes and offenders (e.g., mental health, substance...
    asked 53 minutes ago
  • An air-track cart with mass m=0.40kg and speed v0=1.2m/s approaches two other carts that are at...
    asked 53 minutes ago
  • Write a program in C# that reverses a collection and removes elements that are divisible by...
    asked 56 minutes ago
  • A gas pipeline with the thickness of 4mm is to be joint together by using welding...
    asked 1 hour ago