1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
artcher [175]
3 years ago
11

(Convert letter grade to number) Write a program that prompts the user to enter a letter grade A/a, B/b, C/c, D/d, or F/f and di

splays its corresponding numeric value 4, 3, 2, 1, or 0.
Sample Run 1 Enter a letter grade: B The numeric value for grade B is 3

Sample Run 2 Enter a letter grade: b The numeric value for grade b is 3

Sample Run 3 Enter a letter grade: T T is an invalid grade
Computers and Technology
1 answer:
grin007 [14]3 years ago
5 0

Answer:

This program is written in Python Programming Language

Program doesn't make use of comments (See Explanation Section for detailed explanation)

letterg = ['A','B','C','D','F']

inp = input("Enter a Letter Grade: ")

for i in range(len(letterg)):

if inp.upper() == letterg[i]:

print('The numeric value for grade ', inp, ' is ',4 - i)

break;

else:

print(inp, "is an invalid grade")

Explanation:

This line initializes all letter grade from A to F

letterg = ['A','B','C','D','F']

This line prompts user for letter grade

inp = input("Enter a Letter Grade: ")

This line iterates through the initialized letter grades

for i in range(len(letterg)):

This line checks if the user input is present in the initialized letter grades (it also takes care of lowercase letters)

if inp.upper() == letterg[i]:

This line is executed if tge about condition is true; the line calculates the number grade and prints it

print('The numeric value for grade ', inp, ' is ',4 - i)

This line terminates the iteration

break;

If the condition above is not true

else:

This line is executed

print(inp, "is an invalid grade")

You might be interested in
Why should you try to contact the technical support staff of a web hosting provider before you become one of its customers?
Marianna [84]

Answer: Contacting technical support can give you a general idea of the responsiveness of the web host provider to issues and problems. If the technical support staff is slow getting back to you at this point, don't be surprised if you get the same type of service when you have a problem and need immediate help. While not fail-safe, a quick response to a simple question at least gives the appearance of a well-organized, professional, and responsive technical support staff.

7 0
3 years ago
April's manager has asked her to provide the financial service manager with the accounts that have not received payment. What sh
Irina-Kira [14]
C should be the answer to this I hope that this helps
4 0
4 years ago
Read 2 more answers
Hey, how do we get our warnings removed?
Effectus [21]

Answer:

post good answers

Explanation:

6 0
2 years ago
Read 2 more answers
Why was the microchip essential to improving computers?
-BARSIC- [3]
Because it downsized the scale of the computer itself.

5 0
3 years ago
Write a program whose input is two integers. Output the first integer and subsequent increments of 10 as long as the value is le
Lubov Fominskaja [6]

Answer:

import java.util.Scanner;

public class TestClock {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter two integer numbers");

       int num1 = in.nextInt();

       int num2 = in.nextInt();

       int newSum=num1+10;

       System.out.println("The first number is "+num1);

       do{

          System.out.println(newSum);

          newSum +=10;

       }while (newSum <=num2);

   }

}

Explanation:

Using Java Programming language

  1. Prompt user for the two inputs and save them as num1 and num2(Using the scanner class)
  2. Create a new Variable newSum = num1+10
  3. Create a do...while loop to continually print the value of newSum, and increment it by 10 while it is less or equal to num2
3 0
3 years ago
Other questions:
  • Which sector provides scope for multimedia designers?
    10·1 answer
  • How does consumption of alcohol affect your driving skills? Name three ways that alcohol can affect your driving.
    15·2 answers
  • ______________________________Encompasses all of the information contained within a single business process or unit of work, and
    8·1 answer
  • Which device prints large, three-dimensional high-quality color graphics?
    15·1 answer
  • Select all the correct answers. Which two statements are true about an OS? translates the user's instructions into binary to get
    10·1 answer
  • Computers can think for themselves<br><br> True<br><br> False
    6·2 answers
  • Write a recursive function, displayFiles, that expects a pathname as an argument. The path name can be either the name of a file
    6·1 answer
  • What is not true of credit scores?
    11·1 answer
  • Which of the following is not a valid SQL command? (Points : 2) UPDATE acctmanager SET amedate = SYSDATE WHERE amid = 'J500';
    11·1 answer
  • Explain what iteration is and why we need it in code
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!