0% found this document useful (0 votes)
27 views2 pages

Set Questions

The document outlines various programming tasks related to managing car models and parts for a manufacturing company. It includes exercises for finding common and unique car models produced in different years, tracking parts across factories, identifying discontinued models, managing spare parts inventory, and recognizing custom features in car orders. Each task is presented with sets of data and specific programming requirements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Set Questions

The document outlines various programming tasks related to managing car models and parts for a manufacturing company. It includes exercises for finding common and unique car models produced in different years, tracking parts across factories, identifying discontinued models, managing spare parts inventory, and recognizing custom features in car orders. Each task is presented with sets of data and specific programming requirements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SET

question:1

Managing Unique Car Models


A car manufacturing company produces various models of cars, some of which have similar features. They
want to keep track of unique car models produced in the last 5 years.

Given two sets of car models produced in the years 2019 and 2023:

In [1]: models_2019 = {"Model S", "Model X", "Model 3", "Model Y"}
models_2023 = {"Model 3", "Model Y", "Model Z", "Model A"}

Write a Python program to find:

The models that were produced in both years.

The models that are unique to each year.

Question 2:

Tracking Unique Parts Across Factories


A car manufacturing company has two factories. Each factory specializes in different car parts, but some
parts may be produced in both factories.

In [4]: # given sets


factory_A_parts = {"engine", "brake", "gearbox", "seat", "headlight"}
factory_B_parts = {"seat", "dashboard", "gearbox", "wheel", "headlight"}

Write a Python program to:

Find the parts common to both factories.

List the parts produced only in factory A and not in factory B.

Discontinued Car Models


The company decided to stop manufacturing some car models that are no longer in demand.

Given the sets:

In [5]: current_models = {"Sedan", "SUV", "Truck", "Hatchback"}


discontinued_models = {"Coupe", "Convertible", "Truck", "Hatchback"}

Write a Python program to:

Find the models that are still in production.


Find the models that were discontinued.

Inventory Management for Spare Parts


The company maintains a warehouse of spare parts, where some parts are being restocked frequently.

Given the sets:

In [6]: warehouse_parts = {"engine", "brake", "tire", "radiator", "mirror"}


restocked_parts = {"tire", "brake", "radiator", "windshield"}

Identify which parts are in the warehouse but not currently being restocked.

Find the parts that are restocked and already in the warehouse.

Identifying Custom Features in Car Orders


The company offers custom features for their cars, and some customers choose different combinations of
features.

Given the following sets representing features chosen by two customers:

In [8]: customer_1_features = {"leather seats", "sunroof", "premium sound", "GPS"}


customer_2_features = {"premium sound", "sunroof", "automatic parking", "heated seats"}

Write a Python program to:

Find the features both customers selected.

List the features that are unique to each customer.

In [ ]:

You might also like