forked from shannonturner/python-lessons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlesson03_states.py
32 lines (25 loc) · 1.33 KB
/
lesson03_states.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Challenge Level: Beginner
# Background: You have a text file with all of the US state names:
# states.txt: See section_07_(files).
#
# You also have a spreadsheet in comma separated value (CSV) format, state_info.csv. See also section_07_(files)
# state_info.csv has the following columns: Population Rank, State Name, Population, US House Members, Percent of US Population
# Challenge 1: Open states.txt and use the information to generate an HTML drop-down menu as in: https://github.com/shannonturner/python-lessons/blob/master/playtime/lesson02_states.py
# Challenge 2: Save the HTML as states.html instead of printing it to screen.
# Your states.html should look identical (or at least similar) to the one you created in the Lesson 2 playtime, except you're getting the states from a file instead of a list.
# Challenge 3: Using state_info.csv, create an HTML page that has a table for *each* state with all of the state details.
# Sample output:
# <table border="1">
# <tr>
# <td colspan="2"> California </td>
# </tr>
# <tr>
# <td> Rank: 1 </td>
# <td> Percent: 11.91% </td>
# </tr>
# <tr>
# <td> US House Members: 53 </td>
# <td> Population: 38,332,521 </td>
# </tr>
# </table>
# Challenge 4 (Not a Python challenge, but an HTML/Javascript challenge): When you make a choice from the drop-down menu, jump to that state's table.