Answered step by step
Verified Expert Solution
Question
1 Approved Answer
**Please complete code for all the parts in problem C. and screenshots of your code would be great or an easy way to read the
**Please complete code for all the parts in problem C. and screenshots of your code would be great or an easy way to read the code will be great.Thank you
c) Suppose a class takes a multiple-choice test. We're going to experiment with alternative scoring mechanisms. For this problem you'll want to say from random import (and use the methods randrange and choice, which you can look up in the text or using helpCrandom) Let's say you have these three global constants defined (a complete program might determine these values from reading a file; we're just doing it this way for convenience): NUMBER_OF STUDENTS 200 NUMBER OF_QUESTIONS20 NUMBER-OF-CHOICES-4 # 3 choices is A/B/C, 4 choices is A/B/C/D, 5 is A/B/C/D/E Use the identifiers NUMBER_OF_STUDENTS, NUMBER_OF_QUESTIONS, and NUMBER_OF_CHOICES in your code rather than the hard-coded constants 200, 20, and 4. And of course your code should work correctly when different values are assigned to these identifiers (C.1) Write a function called correct-answers that generates and returns a string of letters representing the correct answers to the test. Of course answers to real tests aren't chosen randomly! We're just doing it this way to produce some test data to use when we score students' answers.) The length of the string should be the number of questions; each character in the string should be chosen randomly from the first n letters of the alphabet (where n is the number of choices). [Use the choice method. Call correct_answers to produce the answers we'll use; assign the result to another global constant called ANSWERS c) Suppose a class takes a multiple-choice test. We're going to experiment with alternative scoring mechanisms. For this problem you'll want to say from random import (and use the methods randrange and choice, which you can look up in the text or using helpCrandom) Let's say you have these three global constants defined (a complete program might determine these values from reading a file; we're just doing it this way for convenience): NUMBER_OF STUDENTS 200 NUMBER OF_QUESTIONS20 NUMBER-OF-CHOICES-4 # 3 choices is A/B/C, 4 choices is A/B/C/D, 5 is A/B/C/D/E Use the identifiers NUMBER_OF_STUDENTS, NUMBER_OF_QUESTIONS, and NUMBER_OF_CHOICES in your code rather than the hard-coded constants 200, 20, and 4. And of course your code should work correctly when different values are assigned to these identifiers (C.1) Write a function called correct-answers that generates and returns a string of letters representing the correct answers to the test. Of course answers to real tests aren't chosen randomly! We're just doing it this way to produce some test data to use when we score students' answers.) The length of the string should be the number of questions; each character in the string should be chosen randomly from the first n letters of the alphabet (where n is the number of choices). [Use the choice method. Call correct_answers to produce the answers we'll use; assign the result to another global constant called ANSWERS
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started