首页 >
> 详细

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
- 微信：codinghelp2

- Ee6435 Programming Homework 2020-05-30
- Computer Architecture Homework 3 2020-05-30
- Infs7450作业代做、Media Analytics作业代写、Pytho 2020-05-29
- 代写stats 782作业、代做r编程设计作业、代写data留学生作业、R课 2020-05-29
- 代写math223作业、R课程设计作业代做、代写data课程作业、R程序语言 2020-05-28
- 代写kxo151留学生作业、代做programming作业、Java语言作业 2020-05-28
- Math 160作业代做、Data课程作业代写、Matlab程序设计作业调试 2020-05-28
- 代做csci 3120作业、Program课程作业代做、C/C++语言作业代 2020-05-28
- St2020课程作业代做、Statistics作业代做、R程序设计作业调试、 2020-05-28
- Com1005作业代写、Ai Techniques作业代做、Java语言作业 2020-05-28
- 代写sit216留学生作业、Python程序语言作业调试、Java/C++实 2020-05-28
- 代写artificial课程作业、Java，Python程序语言作业调试、C 2020-05-27
- Comp Sci 3306作业代写、Python编程语言作业调试、代做jav 2020-05-27
- Data留学生作业代写、代做r课程设计作业、Analytics作业代做、R编 2020-05-27
- Csci 3120作业代做、C++程序语言作业调试、代做c/C++课程作业、 2020-05-26
- 代写algorithms作业、Data留学生作业代做、代写java、Pyth 2020-05-26
- Data Science作业代写、C++程序设计作业代写、Programmi 2020-05-26
- Data课程作业代写、C++编程设计作业调试、C/C++语言作业代做、Alg 2020-05-26
- 代写r留学生作业、代做data课程作业、代写r编程语言作业代做r语言编程|调 2020-05-25
- Cosc473作业代做、Systems作业代写、Python编程设计作业调试 2020-05-25