Starting Out with Python (3rd Edition)
3rd Edition
ISBN: 9780133582734
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 5, Problem 15TF
IPO charts provide only brief descriptions of a function’s input, processing, and output, but do not show the specific steps taken in a function.
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule03:07
Students have asked these similar questions
IPO charts provide only brief descriptions of a function’s input, processing, and output, but do not show the specific steps taken in a function.True or False
Plants Growth Cycle
Learning Objectives
In this lab, you will practice:
Defining a function to match the given specifications
Calling the function in your program
Using if statements (can combine them with dictionaries)
Instructions
For every plant, there is a growth cycle. The number of days that it takes starting from being a seed and ending in being a fruit is what is called the growth cycle. Write a function that takes a plant's name as an argument and returns its growth cycle (in days).
In your program:
Input from the user the name of a plant
Check if the input is either "strawberry", "cucumber" or "potato", if Yes:
2.1 Call calculate_growth_cycle
2.2. In function calculate_growth_cycle, check over the plant's name:
2.2.1 If strawberry, print "### The life cycle of a strawberry ###" and return 110
2.2.2 If cucumber, print "### The life cycle of a cucumber ###" and return 76
2.2.3 If potato, print "### The life cycle a potato ###" and return 120
2.3 With the growth cycle…
How does the usage of a function improve your life?
Chapter 5 Solutions
Starting Out with Python (3rd Edition)
Ch. 5.2 - A function definition has what two parts?Ch. 5.2 - What does the phrase calling a function mean?Ch. 5.2 - When a function is executing, what happens when...Ch. 5.2 - Prob. 9CPCh. 5.4 - What is a local variable? How is access to a local...Ch. 5.4 - What is a variables scope?Ch. 5.4 - Prob. 12CPCh. 5.5 - What are the pieces of data that are passed into a...Ch. 5.5 - What are the variables that receive pieces of data...Ch. 5.5 - Prob. 15CP
Ch. 5.5 - When a parameter is changed, does this affect the...Ch. 5.5 - The following statements call a function named...Ch. 5.6 - What is the scope of a global variable?Ch. 5.6 - Give one good reason that you should not use...Ch. 5.6 - Prob. 20CPCh. 5.7 - How does a value-returning function differ from...Ch. 5.7 - Prob. 22CPCh. 5.7 - Prob. 23CPCh. 5.7 - What does the following statement do? x =...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - When the random module is imported, what does it...Ch. 5.7 - What happens if the same seed value is always used...Ch. 5.8 - Prob. 31CPCh. 5.8 - Look at the following function definition: def...Ch. 5.8 - What is a Boolean function?Ch. 5.9 - What import statement do you need to write in a...Ch. 5.9 - Write a statement that uses a math module function...Ch. 5.9 - Write a statement that uses a math module function...Ch. 5.1 - What is a function?Ch. 5.1 - Prob. 2CPCh. 5.1 - How do functions help you reuse code in a program?Ch. 5.1 - How can functions make the development of multiple...Ch. 5.1 - How can functions make it easier for programs to...Ch. 5 - A group of statements that exist within a program...Ch. 5 - A design technique that helps to reduce the...Ch. 5 - The first line of a function definition is known...Ch. 5 - You___a function to execute it. a. define b. call...Ch. 5 - A design technique that programmers use to break...Ch. 5 - Prob. 6MCCh. 5 - A ______ is a variable that is created inside a...Ch. 5 - Prob. 8MCCh. 5 - Prob. 9MCCh. 5 - Prob. 10MCCh. 5 - A variable that is visible to every function in a...Ch. 5 - Prob. 12MCCh. 5 - This is a prewritten function that is built into a...Ch. 5 - This standard library function returns a random...Ch. 5 - This standard library function returns a random...Ch. 5 - This standard library function returns a random...Ch. 5 - This statement causes a function to end and sends...Ch. 5 - This is a design tool that describes the input,...Ch. 5 - This type of function returns either True or...Ch. 5 - This is a math module function. a. derivative b....Ch. 5 - The phrase "divide and conquer" means that all of...Ch. 5 - Functions make it easier for programmers to work...Ch. 5 - Function names should be as short as possible.Ch. 5 - Calling a function and defining a function mean...Ch. 5 - A flowchart shows the hierarchical relationships...Ch. 5 - A hierarchy chart does not show the steps that are...Ch. 5 - A statement in one function can access a local...Ch. 5 - In Python, you cannot write functions that accept...Ch. 5 - In Python, you can specify which parameter an...Ch. 5 - You cannot have both keyword arguments and...Ch. 5 - Some library functions are built into the Python...Ch. 5 - You do not need to have an import statement in a...Ch. 5 - Complex mathematical expressions can sometimes be...Ch. 5 - A function in Python can return more than one...Ch. 5 - IPO charts provide only brief descriptions of a...Ch. 5 - How do functions help you to reuse code in a...Ch. 5 - Name and describe the two parts of a function...Ch. 5 - When a function is executing, what happens when...Ch. 5 - What is a local variable? What statements are able...Ch. 5 - What is a local variable's scope?Ch. 5 - Prob. 6SACh. 5 - Suppose you want to select a random number from...Ch. 5 - What statement do you have to have in a...Ch. 5 - What three things are listed on an IPO chart?Ch. 5 - What is a Boolean function?Ch. 5 - Prob. 11SACh. 5 - Write a function named times_ten. The function...Ch. 5 - Examine the following function header, then write...Ch. 5 - Look at the following function header: der...Ch. 5 - What will the following program display? def main...Ch. 5 - Look at the following function definition def...Ch. 5 - Write a statement that generates a random number...Ch. 5 - The following statement calls a function named...Ch. 5 - A program contains the following function...Ch. 5 - Write a function named times_ten that accepts a...Ch. 5 - Write a function named get_first_name that asks...Ch. 5 - Kilometer Converter The Kilometer Converter...Ch. 5 - Sales Tax Program Refactoring Programming Exercise...Ch. 5 - How Much Insurance? Many financial experts advise...Ch. 5 - Automobile Costs Write a program that asks the...Ch. 5 - Property Tax A county collects property taxes on...Ch. 5 - Calories from Fat and Carbohydrates A nutritionist...Ch. 5 - Stadium Seating There are three seating categories...Ch. 5 - Paint Job Estimator A painting company has...Ch. 5 - Monthly Sales Tax A retail company must file a...Ch. 5 - Feet to Inches The Feet to Inches Problem One foot...Ch. 5 - Math Quiz Write a program that gives simple math...Ch. 5 - Maximum of Two Values Write a function named max...Ch. 5 - Falling Distance When an object is falling because...Ch. 5 - Kinetic Energy In physics, an object that is in...Ch. 5 - Test Average and Grade Write a program that asks...Ch. 5 - Odd/Even Counter In this chapter, you saw an...Ch. 5 - Prime Numbers A prime number is a number that is...Ch. 5 - Prime Number List This exercise assumes that you...Ch. 5 - Future Value Suppose you have a certain amount of...Ch. 5 - Random Number Guessing Game Write a program that...Ch. 5 - Rock, Paper, Scissors Game Write a program that...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Look at the following function definition: void getNumber(int n) { cout "Enter a number: "; cin n; } In this ...
Starting Out with C++ from Control Structures to Objects (9th Edition)
The preceding question shows a bug in the toString method. Revise the toString() method to fix the error.
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Lottery Number Generator Design a program that generates a 7-digit lottery number. The program should have an I...
Starting Out with Programming Logic and Design (4th Edition)
Describe a method that can be used to gather a piece of data such as the users age.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Create another ticket machine for tickets of a different price; remember that you have to supply this value whe...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
What are the design issues for character string types?
Concepts of Programming Languages (11th Edition)
Knowledge Booster
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
- C Language Create 3 functions for your program. Function 1: Display MenuCreate a function to display your Café Menu as reference before ordering. This function has no return type and no input parameter. Function 2: Determine item priceCreate a function to determine the price of each item in order to facilitate calculation of total bill.Your function will take input of food item and return price for the item. Function 3: Calculate total bill and balance of paymentCreate a function to calculate the total bill of the customer and also the balance after the paymenthas been made.arrow_forwardCase Study – Depreciation Calculator Design and develop a solution with functions (modules) and control structures for a program that, given an original value, a depreciation percentage and a number of years, calculates the depreciated value after the number of years entered. Show the depreciation and current value at the end of each year. Original Value : $ 8000 Depreciation percentage (%) : 20 Number of year : 3 DEPRECIATION TABLE Beginning Value 8000.00 6400.00 Depreciation 1600.00 Year Current Value 1 6400.00 1280.00 5120.00 5120.00 1024.00 4096.00 The program should allow the user to repeat this process as many times as the user likes. Also, to make your program more robust and avoid problems at run time, do as much status/error checking as you can in your program. Q2. Construct a structure chart with data flow and execution of conditional and loops to represent the hierarchical structure of modules. Note that the design of the hierarchical structure of modules should be…arrow_forwardTracking laps Learning Objectives In this lab, you will practice writing functions, passing arguments and returning results from the function printing the result of a function call writing your code as a module Instructions Main Idea An Olympic-size swimming pool is used in the Olympic Games, where the racecourse is 50 meters (164.0 ft) in length. "In swimming, a lap is the same as a length. By definition, a lap means a complete trip around a race track, in swimming, the pool is the race track. Therefore if you swim from one end to the other, you’ve completed the track and thus you’ve completed one lap or one length." (Source: What Is A Lap In Swimming? Lap Vs Length) Write the function meters_to_laps() that takes a number of meters as an argument and returns the real number of laps. Complete the program to output the number of laps with two digits after the period. Examples Input: 150 Output : 3.00 Input: 80 Output: 1.60 Your program must define and call the following…arrow_forward
- A function may have any number of return statements each returning different values.arrow_forwardComputer science What is the advantage of breaking your application’s code into several small functions?arrow_forwardThe functions that are defined according to our requirements are called ____ (A) Good functions (B) Modules (C) User defined functions (D) Library functionsarrow_forward
- Programarrow_forwardC# Programming: Create a user-defined function of your choice that takes a string parameter and prints it in the output.arrow_forwardLISP Function help please LISP Programming only A function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. Use the built-in elt. Extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ function call, and do the same thing for the next day. Make the function return true (t) instead of the last thing it evaluates, to avoid seeing the message printed more than once.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Python - bracket parenthesis and braces; Author: MicroNG;https://www.youtube.com/watch?v=X5b7CtABvrk;License: Standard Youtube License