A certain instructor assigns a 50-point problem and calculates an integer score 0-50 and assigns a letter grade according to the scale 40 - 50 is an A, 30 - 39 is a B, 20 - 29 is a C, 10 - 19 is a D and 0 - 9 is an F. Write a Python function called letter_grade which takes one argument, an integer, and RETURNS the appropriate letter grade.

Answers

Answer 1

Answer:

Following are the code to this question:

def letter_grade(x): #defining a method letter_grade that accepts one parameter

   if x>=50 and x<=40:#defining if block that check value of x greater than 50 and less than 40

       print("A")#print value

   if x>=30 and x<=39:#defining if block that check value of x greater than 30 and less than 39

       print("B")#print value

   if x>=20 and x<=29:#defining if block that check value of x greater than 20 and less than 29

       print("C")#print value

   if x>=10 and x<=19:#defining if block that check value of x greater than 10 and less than 19

       print("D")#print value

   if x>=0 and x<=9:#defining if block that check value of x greater than 0 and less than 9

       print("F")#print value

letter_grade(30) #calling the method letter_grade

Output:

B

Explanation:

In the above Python code, a method "letter_grade" is declared, that accepts an integer variable in its parameter, and defined the multiple if block to check the given value, which can be defined as follows:

In the first, if block, it checks the value of x greater than 50 and less than 40 , if the condition is true it will print the value "A".In the second, if block, it checks the value of x greater than 30 and less than 39,  if the condition is true it will print the value "B".In the third, if block, it checks the value of x greater than 20 and less than 29,  if the condition is true it will print the value "C".  In the fourth, if block, it checks the value of x greater than 10 and less than 19,  if the condition is true it will print the value "D".In the fifth, if block, it checks the value of x greater than 0 and less than 9,  if the condition is true it will print the value "F".

And at the last it call the method.


Related Questions

Application software helps run the computer and coordinates instructions with the hardware.
A. True
B. False

Answers

Answer:

A. True

Explanation:

A group of students is performing an investigation to measure how much liquid water is produced from a 10 L sample of snow. What must occur in order for the students to perform this investigation?

Answers

Answer:

the temperature of the sample must change

Explanation:

As a sysadmin you will find yourself doing business with a variety of third party vendors which of these are likely to be rented or bought from a vendors

Answers

Answer:

Printing devices

Video, Audio devices

Communication machines

Explanation:

Printing devices - Sysadmin needs this type of devices for print important data and information.

Video, Audio devices - Sysadmin needs this type of devices for better communication and interaction.

Communication(fax) machines - Sysadmin needs this type of devices for written communication and interaction and deals.

Which of the following options allow you to access a computer remotely?

a. NTP
b. SSH
c. Server
d. VPN

Answers

Answer:

b. SSH

Explanation:

Secure Shell (SSH) is a protocol that allows you to access a computer remotely by providing safe network communications via an unsecured network.

Secure Shell (SSH) protocol can be used to perform essential functions such as protected file transfers, remote access to private network systems, devices, and applications.

Thus, option "B" is the right answer.

Other Questions
ONE MULTIPLE CHOICE QUESTIONHELPPPPPPP!!!! Which of the following has made communication within teams more dificult in recent years?O advancements in technologyO an increasingly global societyO a cuture of disrespectO declining professionalism Traveling upstream (against the current) in a boat, you can travel 35 miles in 7 hours. Ittakes half the time (3.5 hours) to travel the same distance downstream (with thecurrent). Find the speed of the current. Which statement BEST explains how the author'sword choice in the sentence contributes to themeaning of the passage? What is the momentum of a bird with a mass of 2 kg flying at 9 m/s? * The difference of y and 8.1 is 20.Flnd the value of y. differences and similarities between obtuse angle and right angles What are three advantages and disadvantages of having one setting in a story/film? Kiran and Clare live 24 miles away from each other along a rail trail. One Saturday, the two friends started walking toward each other along the trail at 8:00 a.m. with a plan to have a picnic when they meet.ANSWER: Kiran is jogging at 9.6 miles per hour. The Bill of Rights was to be ratified by three-fourths of the ___.A) legislaturesB) SenatorsC) Supreme Court judgesD) House of RepresentativesE) electors 1. What did Benjamin Franklin use to lighten the mood in Philadelphla where the Constitution was being written? Ice cream An air-cooling device he had Invented Sense of humor Poetic readings Why do claims need to be supported? Instead, a meaningful argument has to establish its supporting claims, as well, in order to establish validity and sway readers. In academic writing, supporting claims do most of the real work. the points (-5,4)and (1,r) lie on a line with slope -1. Find the missing coordinates r. what is (5) 2 and how do i solve Please help!!!!!!!!!!! How can speed and velocity be used to describe motion? Which of the following best describes the slope of line that passes through the points (-3,8) and (-3,11)?increasingdecreasingzeroundefined Find the direction cosines of cartesian coordinates (3, -1, 2). Fill in the blank in the following sentence with the appropriate pronoun below. Les livres sont chez mes amis. Les livres sont chez ______.A. ellesB. nousC. euxD. lui. I NEED HELP IMMEDIATELY