Python_Institute
PCEP-30-02 · Question #334
PCEP-30-02 Question #334: Real Exam Question with Answer & Explanation
Sign in or unlock PCEP-30-02 to reveal the answer and full explanation for question #334. The question stem and answer options stay visible for context.
Question
You are designing a decision structure to convert a student's numeric grade to a letter grade. The program must assign a letter grade as specified as followed:
90 through 100 -> A
80 through 89 -> B
70 through 79 -> C
65 through 69 -> D
0 through 64 -> F
For example, if the user enters a 90, the output should be Your letter grade is A. Likewise, if a user enters an 89, the output should be Your letter grade is B.
Consider the code below. Which of the following code blocks should you insert on Line-3, Line-5, Line-7 and Line-9 to correctly implement the grade conversion logic?
Letter Grade Converter
grade = int(input('Enter a numeric grade:'))Line-3
letter_grade = 'A'Line-5
letter_grade = 'B'Line-7
letter_grade = 'C'Line-9
letter_grade = 'D' else: letter_grade = 'F' print('Your letter grade is:', letter_grade)Options
- Aif grade >= 90: elif grade >= 80: elif grade >= 70: elif grade >= 65:
- Bif grade > 90: elif grade > 80: elif grade > 70: elif grade > 65:
- Cif grade < 90: elif grade < 80: elif grade < 70: elif grade < 65:
- Dif grade <= 90: elif grade <= 80: elif grade <= 70: elif grade <= 65:
Unlock PCEP-30-02 to see the answer
You've previewed enough free PCEP-30-02 questions. Unlock PCEP-30-02 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.