|
First Summer 2008 |
But not much will be used with that.
The goal of the lab will be for you to write new programs, based on the lecture:
>>> What is the car's efficiency (miles/gallon)? 20 How many gallons of fuel do you have? 3.5 Your car's autonomy is: 70.0 miles. >>>
>>> What is amount of money? 100 After one year the amount becomes 105.0 After two years the amount becomes 110.25 After three years the amount becomes 115.7625 After four years the amount becomes 121.550625 After five years the amount becomes 127.62815625 After six years the amount becomes 134.009564062 After seven years the amount becomes 140.710042266 After eight years the amount becomes 147.745544379 After nine years the amount becomes 155.132821598 After ten years the amount becomes 162.889462678 >>> What is amount of money? 5000 After one year the amount becomes 5250.0 After two years the amount becomes 5512.5 After three years the amount becomes 5788.125 After four years the amount becomes 6077.53125 After five years the amount becomes 6381.4078125 After six years the amount becomes 6700.47820312 After seven years the amount becomes 7035.50211328 After eight years the amount becomes 7387.27721895 After nine years the amount becomes 7756.64107989 After ten years the amount becomes 8144.47313389
>>> Enter number: 3 The average so far is: 3.0 / 1 = 3.0 Enter number: 2 The average so far is: 5.0 / 2 = 2.5 Enter number: 3 The average so far is: 8.0 / 3 = 2.66666666667 Enter number: 4 The average so far is: 12.0 / 4 = 3.0 Enter number: 3 The average so far is: 15.0 / 5 = 3.0 Enter number: 5 The average so far is: 20.0 / 6 = 3.33333333333 Thanks for using this program. >>>
Note: in your program you must use only two variables at most.
>>> Enter sentence: there is a tomato in every automaton th(e)r(e) (i)s (a) t(o)m(a)t(o) (i)n (e)v(e)ry (a)(u)t(o)m(a)t(o)n >>>
>>> Enter sentence: there is a tomato in every automaton thr s tmt n vry tmtn >>>
So today in lab we will work on these programs.