Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3. (15 points) Below is a list of U.S. state information that consists of sub-li

ID: 3698673 • Letter: 3

Question

3. (15 points) Below is a list of U.S. state information that consists of sub-lists. Each sub-list has a state abbreviation, the full state name, and the name of the state capitol. Write a function called "Dict" that takes the states list as input, creates a dictionary from the information in the list, usesa 'for' loop to print the completed d caller. The dictionary key is the state abbreviation. The values corresponding to the key are the state name and capitol. The dictionary values are to be added as a list (not tuple) since we may want to change them in the future. keys and values, and returns the dictionary to the tates [l"AK", "Alaska","Juneau'"],['AZ","Arizona", "Phoenix"I'CA "California" Sacramento"1

Explanation / Answer

# Create a empty function dict StateCapitals
StateCapitals = dict()

# Fill it with demo values like
StateCapitals['s1'] = 'c1'
StateCapitals['s2'] = 'c2'
StateCapitals['s3'] = 'c3'

States= ['s1', 's2', 's3', 's4']

for State in States:
# For each state from the list, check if it is in the dictionary Capitals
if state in Capitals:
print(State + ': ' + StateCapitals[country])
else:
print(State + ' is unknown')

r1= raw_input("enter state")

if r1 == statecapitals

print(State + ': ' + StateCapitals[country])

else:
print(State + ' is unknown')

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote