• Home
  • Textbooks
  • The Practice of Computing Using Python
  • Algorithms and Program Development

The Practice of Computing Using Python

William F. Punch, Richard Enbody

Chapter 4

Algorithms and Program Development - all with Video Answers

Educators


Chapter Questions

Problem 1

Write an algorithm for frying an egg. Test it out with a friend: in a kitchen, read the algorithm and have the friend do exactly what you say. How did you do?

Check back soon!
01:08

Problem 2

(a) Define algorithm and program.
(b) In what ways are they the same?
(c) In what ways are they different?

Florencia Cuzmar
Florencia Cuzmar
Numerade Educator
08:23

Problem 3

Write an algorithm that determines whether a number is between 2 and 20 and is divisible by 3 .

Willis James
Willis James
Numerade Educator

Problem 4

We mentioned first fit and best fit as applied to finding parking spaces at a mall.
(a) Write a first-fit car-parking algorithm.
(b) Write a best-fit car-parking algorithm.
(c) In your own words, explain why first fit might be a better algorithm on average to minimize the time to get to the door of the mall.

Check back soon!

Problem 5

When you are stuck on creating a program, it helps to stop and think. Can you see what is wrong with the following program? Why is it generating an error?
A_int = input ('Enter an integer greater than 10: ')
while A_int > 10:
A_int $=$ A_int -1
print (A_int)

Check back soon!