SuperTutor

(15)

$15/per page/Negotiable

About SuperTutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Business & Finance See all
Accounting,Business & Finance,Economics,Engineering,HR Management,Math Hide all
Teaching Since: Apr 2017
Last Sign in: 327 Weeks Ago, 5 Days Ago
Questions Answered: 12843
Tutorials Posted: 12834

Education

  • MBA, Ph.D in Management
    Harvard university
    Feb-1997 - Aug-2003

Experience

  • Professor
    Strayer University
    Jan-2007 - Present

Category > Programming Posted 18 May 2017 My Price 9.00

python 3

(python 3)

Read the instructions below carefully. The instructions must be followed. This assignment is worth 5% of your grade. The assignment is due on  Monday 17th of October at 8AM. No late assignments will be accepted.

The goal of this assignment is to learn and practice (via programming and quizzes) the concepts that we have learned in the last two weeks: function design, function calls, branching (that is, if statements), strings, for-loops, range function and lists.

Some of these concepts (range function and lists) will be covered more on Monday/Wednesday class (3/5 Oct). But you can certainly already work on many of the questions. 

This assignment has two parts. Each part explains what needs to be

submitted. Put all those required documents into a folder called a2_xxxxxx, zip it and submit it as explained in lab 1. (In particular, the folder should have the following files:

a2_part1_xxxxxx.py,

a2_part2_xxxxxx.py and a2_part2_xxxxxx.txt

For each function that you design for this assignment you have to include docstrings that specify:

- type contract

- description about what the function does (while mentioning parameter names)

- preconditions, if any

If you do not know what this means revisit the lectures/labs from the past, or read section 3.6 from the “Practical Programming” textbook or alternatively view the following short video:

https://www.youtube.com/watch?v=Q5GR138-Mmk&index=12&list=PLkHsKoi6eZnwpn7P5G8gEBebAY8Jbky4N

*****************************************

PART 1  (20 points)

*****************************************

Suppose you are asked to design a software tool that helps an

elementary school student learn arithmetic operations. The software

allows the student to select the arithmetic operation she or he wishes

to study. The student chooses from a menu one of two arithmetic

operations: Addition and Multiplication. Then the student is asked how

many questions would he/she like to be tested on. That number is

stored in variable called n. Based on the student's

choice and answer, the software tests the student with exactly n

questions. If n is zero no test should be performed). For each of

the n questions, two random positive one-digit integers are generated; then the student is asked to enter the answer for the arithmetic operation applied to the two numbers.

At the end, the software displays a message “Well done! Congratulations.” if at least 80% of

the questions are answered correctly; if at least 60% but less than 80% of

the questions is answered correctly, the program should display

"Not too bad but please study and practice some more.", otherwise, the program should

display "Please study more and ask your teacher for help.".

a)     Implement a Python function, called, perform_test, that will

execute all the arithmetic tests for a student for multiplication or

addition operations. The function has two input parameters; the first one is

an integer, 0 or 1, that represents the required operation (1 for

multiplication and 0 for addition), the second one is a positive

integer n representing the number of questions in the test. Then it gets the student to answer n questions as follows:

     1.   Randomly generates two positive one-digit integers. 

     2.   Ask the student to enter the answer for the arithmetic operation of the two numbers. 

     3.    Checks if the result is correct. If the answer is incorrect, it provides the correct answer. 

As questions are answered, the correct answers are counted. The number of correct answers is returned by the function.

b)    (Outside of the function) implement the main part of the program

to interact with the student to obtain the choice for either

multiplication or addition and the number of questions, then call the

function developed in part (a) to test the student (recall that the function returns the number

of correct answers). Then print one of three possible messages to the

student (“Well done! Congratulations.” or "Not too bad but please

study and practice some more." or "Please study more and ask your

teacher for help.", as determined by the criteria listed above).

Store your program in file called a2_part1_xxxxxx.py

Test it by pressing Run Module.

View the video (in the attachment) that  I made called a2_part1_example_run.mp4 to see how your program

should behave when you run it.

Note that to generate a random number first import module called random

and then use the following function random.randint

Here is what help(random.randint) gives:

"randint(a, b) method of random. Random instance

    Return random integer in range [a, b], including both end points."

Answers

(15)
Status NEW Posted 18 May 2017 06:05 AM My Price 9.00

-----------

Attachments

file 1495090570-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)