Python Programming: An Introduction to Computer Science

(Nora) #1
12 CHAPTER1. COMPUTERSANDPROGRAMS

x = 2.0 * x * (1 - x)

Runtheprogramforvariousinputvaluesandcomparetheresultstothoseobtainedfromtheoriginal
program.Writea shortparagraphdescribingany differencesthatyounoticeinthebehaviorofthetwo
versions.


  1. ModifytheChaosprogramfromSection1.6sothatit printsout 20 valuesinsteadof10.

  2. (Advanced)ModifytheChaosprogramsothatit acceptstwo inputsandthenprintsa tablewithtwo
    columnssimilartotheoneshowninSection1.8. (Note: Youwillprobablynotbeabletogetthe
    columnstolineupasnicelyasthoseintheexample.Chapter4 discusseshow toprintnumberswitha
    fixednumberofdecimalplaces.)

Free download pdf