Pages 77-106 of the Python textbook (you can stop reading at section 4.6)
Supplementary e-reserve articles 3 and 4 (we'll discuss these on Wednesday):
Answer discussion questions 1-4 on pages 116-117. You should try these out interactively at the Python prompt. Make sure you understand what's going on.
Study the Python examples from this week's class notes and be sure you understand them.
Finish all of the lab exercises from class.
Do exercise 17 on page 74 of the textbook (Newton's method). Instead of starting with a guess of x/2, however, just start with 1.0.
Using Python's string operations, write a program called url() that asks the user for a Web URL address, such as http://science.slc.edu/jmarshall/info.html, and prints out the hostname of the address and the name of the file being accessed. For example, the hostname of the above address is science.slc.edu and the filename is info.html. In general, the hostname appears immediately after the double "//" and includes everything up to the first single "/". The filename includes everything after the last "/". Example:
>>> url() Please enter a Web URL: http://science.slc.edu/jmarshall/info.html The hostname is science.slc.edu The filename is info.html >>>
Write a program called remove that asks the user for a string, and a substring appearing in that string, and returns a new string with the first occurrence of the substring removed. Example:
>>> remove() Please enter a string: pineapples Substring to remove: apple The new string is pines
Write a program called reverse that asks the user for a phrase and then prints out the phrase in reverse. Hint: use a for-loop. Example:
>>> reverse() Please enter a phrase: The rain in Spain The phrase backwards is niapS ni niar ehT
Put all of your program definitions into a single file called assign2.py. Print out this file and turn it in to me in class on Wednesday. You don't need to turn in your answers to the practice problems. If you have questions about anything, don't hesitate to ask!