Page 1 of 1

import unittest # 1b # Fill in the q1b function. # Inputs: # states_dict is a dictionary of state abbreviation: state n

Posted: Thu Jul 14, 2022 2:18 pm
by answerhappygod
import unittest
# 1b # Fill in the q1b function.# Inputs:# states_dict is a dictionary of state abbreviation: state name,for example 'HI': 'Hawaii'# state_abbreviation is a string state abbreviateion, for example'HI'# Outputs:# The function should return the state name from the dictionaryprovided for the abbreviation provided, for example q1b({"HI":"Hawaii"}, "HI") should return "Hawaii"
#Test Must pass
def q1b(states_dict, state_abbreviation): # Insert your code return "" #Replace this with the correctreturn value
class TestQuestion1B(unittest.TestCase):
state_lookup = {'NY': 'New York', 'PA':'Pennsylvania', 'FL': 'Florida', 'CA': 'California'} def test_new_york(self): self.assertEqual(q1b(self.state_lookup, 'NY'), 'NewYork')
def test_california(self): self.assertEqual(q1b(self.state_lookup, 'CA'),'California')
def test_florida(self): self.assertEqual(q1b(self.state_lookup, 'FL'), 'Florida')