import unittest # Make a dictionary called fruits_dict with fruit names as keys and the color of the fruit as values. Us

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 # Make a dictionary called fruits_dict with fruit names as keys and the color of the fruit as values. Us

Post by answerhappygod »

import unittest
# Make a dictionary called fruits_dict with fruit names as keysand the color of the fruit as values. Use the following key-valuepairs.# Key | Value# --------------# Apple | Red# Banana | Yellow# Kiwi | Green
def q1a(): # Insert your code return {} # Replace with fruits_dict as describedabove
class TestQuestion1a(unittest.TestCase):
def test_dict_vals(self): fruits_dict = q1a() self.assertIn('Apple',fruits_dict) self.assertIn('Banana',fruits_dict) self.assertIn('Kiwi',fruits_dict) self.assertEqual(fruits_dict['Apple'], 'Red') self.assertEqual(fruits_dict['Banana'], 'Yellow') self.assertEqual(fruits_dict['Kiwi'], 'Green')if __name__ == '__main__': unittest.main()
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply