Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 4 - Selections - Section 4.7 - Nested if and Multi-Way if-elif-else Statements - Check Point - MyProgrammingLab - Page 105: 4.13

Answer

The code will first check the first if statement. If the score = 90, it satisfied the first condition, but it doesn't necessarily mean the student gets a D. The code should first check the condition to see if the score is >= 90. Then the second condition should check to see if the score is >= 80, in that case, if the score is between the value of 80 and 89, the grade will be B. The correct code should look like the following.

Work Step by Step

if score >= 90.0: grade = 'A' elif score >= 80.0: grade = 'B' elif score >= 70.0: grade = "C" elif score >= 60.0: grade = "D" else: grade = "F"
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.