1 Introduction To Computers And Programming 2 Input, Processing, And Output 3 Decision Structures And Boolean Logic 4 Repetition Structures 5 Functions 6 Files And Exceptions 7 Lists And Tuples 8 More About Strings 9 Dictionaries And Sets 10 Classes And Object-oriented Programming 11 Inheritance 12 Recursion 13 Gui Programming expand_more
5.2 Defining And Calling A Void Function 5.3 Designing A Program To Use Functions 5.4 Local Variables 5.5 Passing Arguments To Functions 5.6 Global Variables And Global Constants 5.7 Introduction To Value-returning Functions:generating Random Numbers 5.8 Writing Your Own Value-returning Functions 5.9 The Math Module 5.1 Storing Functions In Modules Chapter Questions expand_more
Problem 1MC: A group of statements that exist within a program for the purpose of performing a specific task is... Problem 2MC: A design technique that helps to reduce the duplication of code within a program and is a benefit of... Problem 3MC: The first line of a function definition is known as the____ a. body b. introduction c.... Problem 4MC: You___a function to execute it. a. define b. call c. import d. export Problem 5MC: A design technique that programmers use to break down an algorithm into functions is known as... Problem 6MC Problem 7MC: A ______ is a variable that is created inside a function. a. global variable b. local variable c.... Problem 8MC Problem 9MC Problem 10MC Problem 11MC: A variable that is visible to every function in a program file is a __________. a. local variable b.... Problem 12MC Problem 13MC: This is a prewritten function that is built into a programming language. a. standard function b.... Problem 14MC: This standard library function returns a random integer within a specified range of values. a.... Problem 15MC: This standard library function returns a random floating-point number in the range of 0.0 up to 1.0... Problem 16MC: This standard library function returns a random floating-point number within a specified range of... Problem 17MC: This statement causes a function to end and sends a value back to the part of the program that... Problem 18MC: This is a design tool that describes the input, processing, and output of a function. a. hierarchy... Problem 19MC: This type of function returns either True or False. a. Binary b. true_false c. Boolean d. logical Problem 20MC: This is a math module function. a. derivative b. factor c. sqrt d. differentiate Problem 1TF: The phrase "divide and conquer" means that all of the programmers on a team should be divided and... Problem 2TF: Functions make it easier for programmers to work in teams. Problem 3TF: Function names should be as short as possible. Problem 4TF: Calling a function and defining a function mean the same thing. Problem 5TF: A flowchart shows the hierarchical relationships between functions in a program. Problem 6TF: A hierarchy chart does not show the steps that are taken inside a function. Problem 7TF: A statement in one function can access a local variable in another function. Problem 8TF: In Python, you cannot write functions that accept multiple arguments Problem 9TF: In Python, you can specify which parameter an argument should be passed into a function call. Problem 10TF: You cannot have both keyword arguments and non-keyword arguments in a function call. Problem 11TF: Some library functions are built into the Python interpreter. Problem 12TF: You do not need to have an import statement in a program to use the functions in the random module Problem 13TF: Complex mathematical expressions can sometimes be simplified by breaking out part of the expression... Problem 14TF: A function in Python can return more than one value. Problem 15TF: IPO charts provide only brief descriptions of a functions input, processing, and output, but do not... Problem 1SA: How do functions help you to reuse code in a program? Problem 2SA: Name and describe the two parts of a function definition. Problem 3SA: When a function is executing, what happens when the end of the function block is reached? Problem 4SA: What is a local variable? What statements are able to access a local variable? Problem 5SA: What is a local variable's scope? Problem 6SA Problem 7SA: Suppose you want to select a random number from the following sequence: 0, 5, 10, 15, 20, 25, 30... Problem 8SA: What statement do you have to have in a value-returning function? Problem 9SA: What three things are listed on an IPO chart? Problem 10SA: What is a Boolean function? Problem 11SA Problem 1AW: Write a function named times_ten. The function should accept an argument and display the product of... Problem 2AW: Examine the following function header, then write a statement that calls the function, passing 12 as... Problem 3AW: Look at the following function header: der my_function(a, b, c): Now look at the following call to... Problem 4AW: What will the following program display? def main (): x = 1 y = 3.4 print(x, y) change_us(x, y)... Problem 5AW: Look at the following function definition def my_function(a, b, c): d = (a + c) / b print(d) a.... Problem 6AW: Write a statement that generates a random number in the range of 1 through 100 and assigns it to a... Problem 7AW: The following statement calls a function named half, which returns a value that is half that of the... Problem 8AW: A program contains the following function definition: def cube(num): return num num num Write a... Problem 9AW: Write a function named times_ten that accepts a number as an argument. When the function is called,... Problem 10AW: Write a function named get_first_name that asks the user to enter his or her first name, and returns... Problem 1PE: Kilometer Converter The Kilometer Converter Problem Write a program that asks the user to enter a... Problem 2PE: Sales Tax Program Refactoring Programming Exercise #6 in Chapter 2 was the Sales Tax program. For... Problem 3PE: How Much Insurance? Many financial experts advise that property owners should insure their homes or... Problem 4PE: Automobile Costs Write a program that asks the user to enter the monthly costs for the following... Problem 5PE: Property Tax A county collects property taxes on the assessment value of property, which is 60... Problem 6PE: Calories from Fat and Carbohydrates A nutritionist who works for a fitness club helps members by... Problem 7PE: Stadium Seating There are three seating categories at a stadium. Class A seats cost 20. Class B... Problem 8PE: Paint Job Estimator A painting company has determined that for every 112 square feet of wall space,... Problem 9PE: Monthly Sales Tax A retail company must file a monthly sales tax report listing the total sales for... Problem 10PE: Feet to Inches The Feet to Inches Problem One foot equals 12 inches. Write a function named... Problem 11PE: Math Quiz Write a program that gives simple math quizzes. The program should display two random... Problem 12PE: Maximum of Two Values Write a function named max that accepts two integer values as arguments and... Problem 13PE: Falling Distance When an object is falling because of gravity, the following formula can be used to... Problem 14PE: Kinetic Energy In physics, an object that is in motion is said to have kinetic energy. The following... Problem 15PE: Test Average and Grade Write a program that asks the user to enter five test scores. The program... Problem 16PE: Odd/Even Counter In this chapter, you saw an example of how to write an algorithm that determines... Problem 17PE: Prime Numbers A prime number is a number that is only evenly divisible by itself and 1. For example,... Problem 18PE: Prime Number List This exercise assumes that you have already written the is_prime function in... Problem 19PE: Future Value Suppose you have a certain amount of money in a savings account that earns compound... Problem 20PE: Random Number Guessing Game Write a program that generates a random number in the range of 1 through... Problem 21PE: Rock, Paper, Scissors Game Write a program that lets the user play the game of Rock, Paper, Scissors... format_list_bulleted