首页 >
> 详细

Instructions

This assignment is to be done INDIVIDUALLY.

You have been provided with skeletons for each of the questions (hw2q1.py, …, hw2q4.py).

Please complete them, then zip them in a file hw2.zip and submit it in Brighspace.

Note:

a) Your program MUST run without syntax errors. In particular, when grading your assignment,

TAs will first open your files with IDLE and press Run Module. If pressing Run Module causes

any syntax error, the grade for the whole assignment will be zero.

b) Please don't modify any headers. If you do, all points related to that question or sub-question

will be deducted.

Question 1 Implement a Python function to calculate the body max index (BMI). In the main

part of the program, ask the user to input the weight in kilograms and the height in meters and

call the function. Based on the value retuned by the function, print a message describing the

result (“underweight” if BMI < 18.5, “normal weight” if 18.5 <= BMI < 25, “overweight” if

25<= BMI <30, and “obese” if BMI >=30.

Question2 Implement a Python function that prints integers from a to b. The main part of the

program should ask the user to input a and b and call the function.

Question 3 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. Based on the student choice, the software tests the user

with exactly 10 questions. For each question, 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.

The software displays the number of correct answers and the message “Congratulations!” if more

than 6 questions are answered correctly, otherwise, the program should display "Please ask your

teacher for help".

a) Implement a Python function to execute the arithmetic test for a student for multiplication

or addition operations. The function receives as parameter an integer that represents the

required operation (1 for multiplication and 0 for addition). Then it gets the student to

answer 10 questions as follows:a. Randomly generates two positive one-digit integers.

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

numbers,

c. 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) Implement the main part of the program to interact with the student to obtain the choice

for either multiplication or addition, then call the function developed in part (a) to test the

student (recall that the function returns the number of correct answers). Then print the

number of correct answers, followed by one of two possible messages

(“Congratulations!” or "Please ask your teacher for help", depending on whether the

student gets more than 6 correct answers or not).

Question 4 Modify your Python program from Q1 so that the user is tested with 10 questions

that are randomly distributed between multiplication and addition. It should also provide the

correct answer for the questions that were answered incorrectly. The modifications are as

follows:

a) Modify the function to receive an integer representing the required operation (1 for

multiplication or 0 for addition), then generate two random numbers, and returns true if

the user has answered the question correctly and false if not.

b) Modify the main part of the program to generate a random integer (0 or 1) value

representing one of the two operations and send the Boolean value to the function to

perform the test (note that the program should call the function 10 times, once for each

question). Then the program counts the number of correct answers and prints it, followed

by one of two possible messages to the student (“Congratulations!” or "Please ask your

teacher for help", depending on whether the student gets more than 6 correct answers or

not).

联系我们

- QQ：99515681
- 邮箱：99515681@qq.com
- 工作时间：8:00-23:00
- 微信：codinghelp

- Data Visualisation And Analytics Assi... 2019-11-15
- Block Breaker Assignment Game Engine ... 2019-11-15
- Data Visualisation And Analytics 2019 2019-11-15
- Event Driven Computing 2019 Assignment... 2019-11-15
- Fit1043 Assignment 3 2019-11-15
- Event Driven Computing Assignment 3 - ... 2019-11-15
- 代做data Ming作业、代写systematic课程作业、代写r编程语言 2019-11-15
- Cs210留学生作业代做、Java编程语言作业调试、Java课程设计作业代写 2019-11-15
- 代写stat 385作业、代做r程序语言作业、代写r课程设计作业、Progr 2019-11-15
- 代写cpeg 222作业、Java，C/C++程序语言作业调试、Python 2019-11-15
- Ece 547作业代做、代写python编程设计作业、代做networks留 2019-11-15
- Csc8202作业代做、Web编程语言作业代写、代做web、Html课程设计 2019-11-15
- 代写mathematics课程作业、Matlab编程语言作业代做、代写mat 2019-11-15
- 代做pyopencl留学生作业、Python程序设计作业调试、Python实 2019-11-15
- Rtos Kernel作业代做、代写python，C++程序语言作业、代做j 2019-11-14
- Algorithm课程作业代写、代做r课程设计作业、R编程语言作业调试、代写 2019-11-14
- 代做fpu留学生作业、代写python，Java编程设计作业、代写c++语言 2019-11-14
- 代写msc/Icy课程作业、代写software留学生作业、代做java语言 2019-11-14
- Cse105留学生作业代做、Java程序语言作业调试、代做programmi 2019-11-14
- 代写fm 9528留学生作业、代做risk Analytics作业、Java 2019-11-14