/ Published in: Python

Python Programming - An Introduction to Computer Science: John Zelle
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#Chapter 1 question 7 #Modify the chaos program so that it accepts two inputs and prints a table with two columns. def main(): print("This program illustrates a chaotic function") x = eval(input("Enter a number between 0 and 1: ")) y = eval(input("Enter another number between 0 and 1: ")) n = eval(input("How many rows should I print?: ")) for i in range(n): x = 3.9 * (x - x * x) y = 3.9 * (y - y * y) print("{0:10.6f} {0:10.6f}" .format(x, y)) main()
Comments
