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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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')
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply