Store numbers in lists.
Modify the program from Exercise 2.6 so that the t and y values are stored in two lists t and y. Thereafter, transverse the lists with a for loop and write out a nicely formatted table of t and y values (using either a zip or range construction). Name of program file: ball_table2.py.
Work with a list.
Set a variable primes to a list containing the numbers 2, 3, 5, 7, 11, and 13. Write out each list element in a for loop. Assign 17 to a variable p and add p to the end of the list. Print out the whole new list. Name of program file: primes.py.
Exercise 2.6
Make a table of function values.
Write a program that prints a table with t values in the first column and the corresponding y(t) = v0t−0.5gt2values in the second column. Use n uniformly spaced t values throughout the interval [0, 2v0/g]. Set v0 = 1, g = 9.81, and n = 11. Name of program file: ball_table1.py.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here