Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Videos

Question
Book Icon
Chapter 6, Problem 9PE
Program Plan Intro

Program to display the letter grade for a score

Program plan:

  • Import the required packages
  • The function named “grade()” is defined and inside the “grade()”,
    • Declare the required array variable named as “grades”.
    • Initialize the for loop where x ranges from 0 to 60
      • The value of grades is set to “F”.
    • Initialize the for loop where x ranges from 60 to 70
      • The value of grades is set to “D”.
    • Initialize the for loop where x ranges from 70 to 80
      • The value of grades is set to “C”.
    • Initialize the for loop where x ranges from 80 to 90
      • The value of grades is set to “B”.
    • Initialize the for loop where x ranges from 90 to 100
      • The value of grades is set to “A”.
    • Return the value stored in the array variable named “grades”
  • In the “main()” function,
    • Generate the prompts to take the user inputs
    • Call the method named “grade()” with user input as the argument.
    • Print the output value.
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
To make a function return more than one result we pass parameters: By value. As int. By void. By reference.
1. A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6.Write a Boolean function named is_prime which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Use the function in a program that prompts the user to enter a number then displays a message indicating whether the number is prime.Tip:Recall that the % operator divides one number by another and returns the remainder of the division. In an expression such as num1 % num2, the % operator will return 0 if num1 is evenly divisible by num2.
The function doit(a,b,c,d) is a function that multiplies the smallest of its integers arguments by 2. If more than one arguments are equal and are the smallest, they are multiplied by 2. For example given a=5,b=3,c=7,d=9, doit (a,b,c,d) changes b to 6. Write the code of the function doit and test it.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License