Starting out with python chapter 5 answers

  • Home
  • Textbooks
  • Starting Out with Python
  • Functions

Problem 2

What is meant by the phrase "divide and conquer"?

Problem 3

How do functions help you reuse code in a program?

Problem 4

How can functions make the development of multiple programs faster?

Problem 5

How can functions make it easier for programs to be developed by teams of programmers?

Problem 6

A function definition has what two parts?

Problem 7

What does the phrase "calling a function" mean?

Problem 8

When a function is executing, what happens when the end of the function's block is reached?

Problem 9

Why must you indent the statements in a block?

Problem 10

What is a local variable? How is access to a local variable restricted?

Problem 12

Is it permissible for a local variable in one function to have the same name as a local variable in a different
function?

Problem 13

What are the pieces of data that are passed into a function called?

Problem 14

What are the variables that receive pieces of data in a function called?

Problem 16

When a parameter is changed, does this affect the argument that was passed into the parameter?

Problem 17

The following statements call a function named . Which of the statements passes arguments by position, and which passes keyword arguments?
a. show data (name=' Kathryn', age=25)
b. show data ('Kathryn', 25)

Problem 18

What is the scope of a global variable?

Problem 19

Give one good reason that you should not use global variables in a program.

Problem 20

What is a global constant? Is it permissible to use global constants in a program?

Problem 21

How does a value-returning function differ from the void functions?

Problem 23

Why are library functions like "black boxes"?

Problem 24

What does the following statement do?
$x=$ random. randint (1,100)

Problem 25

What does the following statement do?
print (random. randint $(1,20))$

Problem 26

What does the following statement do?
print (random.randrange $(10,20))$

Problem 27

What does the following statement do?
print (random. random () )

Problem 28

What does the following statement do?
print (random, uniform (0.1, 0.5))

Problem 29

When the random module is imported, what does it use as a seed value for random number generation?

Problem 30

What happens if the same seed value is always used for generating random numbers?

Problem 31

What is the purpose of the return statement in a function?

Problem 32

Look at the following function definition:
a. What is the name of the function?
b. What does the function do?
c. Given the function definition, what will the following statement display?

Problem 34

What import statement do you need to write in a program that uses the math module?

Problem 35

Write a statement that uses a math module function to get the square root of 100 and assigns it to a variable.

Problem 36

Write a statement that uses a math module function to convert 45 degrees to radians and assigns the value to a variable.

Related Posts

Toplist

Latest post

TAGs