please code in python MCQ are a very popular form of assessment because they can be automatically graded…and the  students can choose an answer at random if they don’t know. The goal of this exercise is to write a function scoreMCQ(attempt, correct), where attempt is  a string that contains the answers of the student and correct is a string with the correct answers. The function should return the number of correct answers. Check first that both strings have the same length, otherwise raise an exception. If both strings are empty the score should be 0 of course. To test your code, you can copy paste the following assert statements as your main function: assert(scoreMCQ("","")==0), "First test failed" assert(scoreMCQ("TFTF","TTTT")==2), "Second test failed" assert(scoreMCQ("TTTT","TTTT")==4), "Third test failed" assert(scoreMCQ("CCCC","ABCD")==1), "Fourth test failed" print("All tests succesfull")

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

please code in python

MCQ are a very popular form of assessment because they can be automatically graded…and the 
students can choose an answer at random if they don’t know.
The goal of this exercise is to write a function scoreMCQ(attempt, correct), where attempt is 
a string that contains the answers of the student and correct is a string with the correct answers.
The function should return the number of correct answers.
Check first that both strings have the same length, otherwise raise an exception.
If both strings are empty the score should be 0 of course.
To test your code, you can copy paste the following assert statements as your main function:
assert(scoreMCQ("","")==0), "First test failed"
assert(scoreMCQ("TFTF","TTTT")==2), "Second test failed"
assert(scoreMCQ("TTTT","TTTT")==4), "Third test failed"
assert(scoreMCQ("CCCC","ABCD")==1), "Fourth test failed"
print("All tests succesfull")

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT