python-course
1. Phone Number and Email Address Extractor:
Use regular expressions to find every phone number and email address in the text file: Phone_Number_and_Email_Address.txt (Links to an external site.)
The output will look something like this:
800.420.7240
415.863.9900
415.863.9950
info@nostarch.com
media@nostarch.com
academic@nostarch.com
2. Strong Password Detection: Write a function that uses regular expressions to make sure the password string it is passed is strong.
- A strong password is defined as one that is at least eight characters long, contains both uppercase and lowercase characters, and has at least one digit.
- 3. The 2010 US Census:
- We have a spreadsheet file censuspopdata.xlsx (Links to an external site.)
- There is just one sheet in the censuspopdata.xlsx (Links to an external site.)spreadsheet, named ‘Population by Census Tract’, and each row holds the data for a single census tract.
- The columns are the tract number (A), the state abbreviation(B), the county name (C), and the population of the tract (D).
- Write a program that will do the following:
- Determine the size of the sheet (max_row and max_column) (3 points)
- Count the total population in column (D) (3 points)
- Count the number of census tracts in each state (3 points)
- 4. Text File to Spreadsheet: Write a program to read in the contents of the text file: Phone_Number_and_Email_Address.txt (Links to an external site.)and insert those contents into a spreadsheet.
________________________________________________
________________________________________________
Hint:
The following code may help in #3:
state_counter = {}
def addone(state):
if state in state_counter:
state_counter[state] += 1
else:
state_counter[state] = 1
- The first line of the text file will be in the first cell of column A, the second line of the text file will be in the second cell of column A, and so on.
- Adjust the size of rows based on the cells’ contents.