A Python string literal is always enclosed in double quotes.
Read moreTable of Contents
Textbook Solutions for Python Programming: An Introduction to Computer Science
Question
Write an improved version of the chaos . py program from Chapter 1 that allows a user to input two initial values and the number of iterations,and then prints a nicely formatted table showing how the values change over time. For example, if the starting values were . 25 and . 26 with 10 iterations, the table might look like this: index 0.25 0.26 ---------------------------- 1 0 . 731250 0 . 750360 2 0 . 766441 0 . 730547 3 0 . 698135 0 . 767707 4 0 . 821896 0 . 695499 5 0 . 570894 0 . 825942 6 0 . 955399 0 . 560671 7 0 . 166187 0 . 960644 8 0 . 540418 0 . 147447 9 0 . 968629 0 . 490255 10 0.118509 0 . 974630
Solution
The first step in solving 5 problem number 36 trying to solve the problem we have to refer to the textbook question: Write an improved version of the chaos . py program from Chapter 1 that allows a user to input two initial values and the number of iterations,and then prints a nicely formatted table showing how the values change over time. For example, if the starting values were . 25 and . 26 with 10 iterations, the table might look like this: index 0.25 0.26 ---------------------------- 1 0 . 731250 0 . 750360 2 0 . 766441 0 . 730547 3 0 . 698135 0 . 767707 4 0 . 821896 0 . 695499 5 0 . 570894 0 . 825942 6 0 . 955399 0 . 560671 7 0 . 166187 0 . 960644 8 0 . 540418 0 . 147447 9 0 . 968629 0 . 490255 10 0.118509 0 . 974630
From the textbook chapter Sequences: Strings, Lists, and Files you will find a few key concepts needed to solve this.
Visible to paid subscribers only
Step 3 of 7)Visible to paid subscribers only
full solution