love123jones
16.07.2020 •
Computers and Technology
(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 displays 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
Solved
Show answers
More tips
- F Food and Cooking How to Cook Julienne? Recipes and Tips...
- D Dating, Love, Relationships 10 Useful Tips on How to Survive a Breakup?...
- F Food and Cooking Apple Cider Vinegar: The Ultimate Health and Beauty Solution...
- C Computers and Internet Е-head: How it Simplifies Life for Users?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
- H Health and Medicine Kinesiology: What is it and How Does it Work?...
Answers on questions: Computers and Technology
- C Computers and Technology Which of the following defines your brains ability to pick and choose specific information to take in and specific information to ignore...
- M Mathematics An inlet pipe on a swimming pool can be used to fill the pool in 47 hours. The drain pipe can be used 5o empty the pool in 48 hours. If the pool is 1/2 filled and then the...
- G Geography Explique o que se entende por atividades industrial....
- E English Read the following selections and answer the question below. What would be the BEST summary of the selection The Mississippi River ? A)The Mississippi River supplies water...
- F French Sujet: La publicité emprisonne l homme dans sesattitudes d enfants. Qu en pensez vous ?...
- M Mathematics 8 students in Mr. Webb s class got an A on the exit ticket. There are 25 students in his class total. What percent of students got an A?*...
- E English Laura’s explanation, “It isn’t a flood, it’s not a tornado, Mother. I am just not popular like you were in Blue Mountain,” mainly serves to Question 3 options: A. illustrate...
- M Mathematics Add t to 6 then divide s by result...
- B Biology Why does our heart beat faster when we exercise?...
- M Mathematics Another song guys and my disc is Andreww#6506...
Ответ:
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")
Ответ:
LET ME IN
Explanation:
I M IN WAITING ROOM