Computegrade in python | Computer Science homework help

Rewrite the grade program from the previous chapter using a function called computegrade that takes a score as its parameter and returns a grade as a string.

Score

Don't use plagiarized sources. Get Your Custom Essay on
Computegrade in python | Computer Science homework help
Just from $5/Page
Order Essay

Grade

> 0.9

A

> 0.8

B

> 0.7

C

> 0.6

D

<= 0.6

F

 

HINT:

1.     Write a custom function with the definition def computegrade(<your score variable>):

2.     The function should compute the grade using the score variable based on the table above. You can use if-elif statements to accomplish this

3.     Ensure your function has a “return” statement to return the computed grade back to the calling program

4.     Once the function is defined, proceed to writing the part of the program that takes in user input for score.

5.     Validate that the score is numeric within a try-except block.

6.     Invoke the above-defined computegrade function with the user-supplied score. Ensure you capture the return value within your program into a variable placeholder, or else use the print statement to print the return value directly

7.     Be sure to comment your program adequately!

8.     Remember your Python code will be graded according to our class Rubric.

9.     Submit your Python code file.  Name it “XXXX-score-function.py” where XXXX is your name. 

10.  Submit also a Word document showing screen shots of the various testing conditions.  Good programmers test all cases, so you should make sure you show tests for each possible grade level (A through F) plus error messages.

 

here is the code I did. run it, it works.

just need to reflect the computegrade and make that work too

 

# Given a given a numerical grade between 0.0 and 1.0

#This program converts the numerical score in letter grade.

 

#Prompt user for score between 0.0 and 1.0

prompt1 = “Please enter a score between 0.0 and 1.0: “

 

#convert input to float, because the input statement accepts user input as a string by default

#Wrap within a try-except code block to exit gracefully as the conversion will fall if the user supplied a non-numeric input!

try:

  score = input (prompt1)

  score = float(score)

 

#Print the result

  if score <=1.0:

   if 0.9 <= score <= 1.0:

      print(“Your grade is an A”)

   elif score >= 0.8:

      print(“Your grade is a B”)

   elif score >= 0.7:

      print(“Your grade is a C”)

   elif score >= 0.6:

      print(“Your grade is a D”)

   elif score <  0.6:

      print(“Your grade is an F”)

 

 

  else:   

   print (“Error, score cannot be greater than 1.0”)

except:

   print (“Error, please enter a number”)

 

 

#End of Script

 

Order a unique copy of this paper
(550 words)

Approximate price: $22

Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

We are committed to making our customer experience enjoyable and that we are keen on creating conditions where our customers feel secured and respected in their interactions with us.
With our qualified expert team who are available 24/7, we ensure that all our customer needs and concerns are met..

Money Payback-back guarantee

Our refund policy allows you to get your money back when you are eligible for a refund. In such a case, we guarantee that you will be paid back to your credit card. Another alternative we offer you is saving this money with us as a credit. Instead of processing the money back, keeping it with us would be an easier way to pay for next the orders you place

Read more

Zero-plagiarism guarantee

All orders you place on our website are written from scratch. Our expert team ensures that they exercise professionalism, the laid down guidelines and ethical considerations which only allows crediting or acknowledging any information borrowed from scholarly sources by citing. In cases where plagiarism is confirmed, then the costumier to a full refund or a free paper revision depending on the customer’s request..

Read more

Free-revision policy

Quality is all our company is about and we make sure we hire the most qualified writers with outstanding academic qualifications in every field. To receive free revision the Company requires that the Customer provide the request within fourteen (14) days from the first completion date and within a period of thirty (30) days for dissertations.

Read more

Privacy policy

We understand that students are not allowed to seek help on their projects, papers and assignments from online writing services. We therefore strive to uphold the confidentiality that every student is entitled to. We will not share your personal information elsewhere. You are further guaranteed the full rights of originality and ownership for your paper once its finished.

Read more

Fair-cooperation guarantee

By placing an order with us, you agree to the service we provide. We will endear to do all that it takes to deliver a comprehensive paper as per your requirements. We also count on your cooperation to ensure that we deliver on this mandate.

Read more

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency