Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON Using a multi-branch if-statement, determine the student's letter grade based on the numeric quiz grade earned. 1. Define a variable called quiz_grade and ask

PYTHON

Using a multi-branch if-statement, determine the student's letter grade based on the numeric quiz grade earned.

1. Define a variable called quiz_grade and ask the user for their quiz grade. Note that the quiz grade will be some value between 0 and 5. You can assume that they will type in a value between 0 and 5. Remember all quiz grades are integers.

2. Write an if elif else statement that checks the value of grade five times. If the grade is equal to 5 print "Student earned an A"; else if the score is equal to 4 print "Student earned a B"; else if the score is equal to 3 print "Student earned a C"; else if the score is equal to 2 print "Student earned a D"; otherwise print "Student earned an F".

Test your code Run this program a minimum of 5 times - once for each possible grades (0 or 1, 2, 3, 4, 5). Once you have determined that all possibilities work as expected, then you are done.

Section Summary: In this section we used the multi-select if-statement to test multiple criteria. Please note that these criteria were not evaluated as a single statement. Instead each criteria is evaluated sequentially one at a time. If the first condition evaluates as False, then the second condition is evaluated. The code in the first if-block is skipped. If the second condition evaluates to True, then the code associated with the second elifblock executes. All other remaining elif-blocks are ignored and execution continues on the first line after the select statment.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Weighted average cost of capital for firm is the

Answered: 1 week ago

Question

What were the issues and solutions proposed by each team?

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago