split
and join
What does the following print?
Suppose the file rick.txt
contains:
Never gonna give you up
What is the output of the following code?
Assume a file called fin.txt
exists in the same directory as the program below, and has the following contents:
Start: 4pm
End: 7pm
3h
What does the following program print?
Implement the following function:
def split_address(addr_line):
""" Split the postal address in address_line into its
component pieces. Return a tuple of strings containing:
(number, street, city, state, zip).
Precondition: the address matches the following format:
"<number> <street>, <city> <state> <zip>"
Example: split_address("516 High St, Bellingham WA 98225")
=> ("516", "High St", "Bellingham", "WA", "98225") """
Download test.txt. Write a program that counts and prints the number of unique lines in the file. Be sure that the text file and your Python program are saved in the same directory.
Implement the following function:
Download AboutYou.csv. Write a Python program to calculate the average number of quarters at Western among each of three groups of students:
Implement the following function:
def spellcheck(in_filename, out_filename wordlist):
""" Write a spellchecked version of in_filename to
out_filename. For each word in the input file, write
it as-is to the output file if it is in the wordlist;
otherwise, write it to the output file in ALLCAPS to
indicate that it's not in the wordlist. """