Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scenario: CompanyBCD, a retail company, has compiled detailed data on its customers and the products they have purchased. This data includes lists of customer names,

Scenario:
CompanyBCD, a retail company, has compiled detailed data on its customers and the products they have purchased.
This data includes lists of customer names, products, product prices, and corresponding barcodes.
Notably, the barcodes are structured in a way that the starting numbers indicate different product segments.
CompanyBCD aims to use this data for customer segmentation to refine its marketing strategies and enhance customer service.
Data Overview:
Customers: A list of 20 customer names.
Products: A list of 20 product names.
Prices: A list of prices for each product.
Barcodes: Each product has a unique barcode.
#Please Run this cell
customers =[
"Emma Johnson", "Liam Smith", "Olivia Williams", "Noah Brown",
"Ava Garcia", "William Jones", "Sophia Miller", "James Davis",
"Isabella Rodriguez", "Benjamin Martinez", "Mia Hernandez",
"Lucas Moore", "Amelia Jackson", "Henry Taylor", "Evelyn Lee",
"Mason Wilson", "Harper Anderson", "Ethan Young", "Ella Martin",
"Alexander White"
]
products =[
"Luxury Watch", "Silicone Wristband", "Weightlifting Set", "Perfume",
"Professional Camera", "Comic Book", "Designer Handbag", "Paperback Novel",
"Gym Membership", "Skincare Set", "Gourmet Coffee Maker", "Toy Train Set",
"High-end Laptop", "Cotton T-shirt", "Fitness Bootcamp", "Wireless Earbuds",
"Yoga Mat", "Running Shoes", "Smartphone", "Sunglasses"
]
prices =[
299.99,19.99,499.99,39.99,999.99,24.99,249.99,14.99,
199.99,49.99,89.99,29.99,1499.99,9.99,299.99,59.99,
34.99,79.99,1299.99,44.99
]
barcodes =[
"2000001","2000002","3000003","2000004",
"1000005","2000006","2000007","2000008",
"3000009","2000010","1000011","2000012",
"1000013","2000014","3000015","1000016",
"3000017","3000018","1000019","2000020"
]
print ("customers:", customers)
print()
print ("products:", products)
print()
print ("prices:", prices)
print()
print ("barcodes:", barcodes)
customers: ['Emma Johnson', 'Liam Smith', 'Olivia Williams', 'Noah Brown', 'Ava Garcia', 'William Jones', 'Sophia Miller', 'James Davis', 'Isabella Rodriguez', 'Benjamin Martinez', 'Mia Hernandez', 'Lucas Moore', 'Amelia Jackson', 'Henry Taylor', 'Evelyn Lee', 'Mason Wilson', 'Harper Anderson', 'Ethan Young', 'Ella Martin', 'Alexander White']
products: ['Luxury Watch', 'Silicone Wristband', 'Weightlifting Set', 'Perfume', 'Professional Camera', 'Comic Book', 'Designer Handbag', 'Paperback Novel', 'Gym Membership', 'Skincare Set', 'Gourmet Coffee Maker', 'Toy Train Set', 'High-end Laptop', 'Cotton T-shirt', 'Fitness Bootcamp', 'Wireless Earbuds', 'Yoga Mat', 'Running Shoes', 'Smartphone', 'Sunglasses']
prices: [299.99,19.99,499.99,39.99,999.99,24.99,249.99,14.99,199.99,49.99,89.99,29.99,1499.99,9.99,299.99,59.99,34.99,79.99,1299.99,44.99]
barcodes: ['2000001','2000002','3000003','2000004','1000005','2000006','2000007','2000008','3000009','2000010','1000011','2000012','1000013','2000014','3000015','1000016','3000017','3000018','1000019','2000020']
To use the lists, please run the above cell
Question-1
The below pseudocode analyzes the price data and categorize both products and customers into specific groups based on their price points in the following categories:
Budget: Prices under 50 USD.
Economy: Prices between 50 USD and 100 USD.
Mid-Range: Prices between 100 USD and 500 USD.
Premium: Prices between 500 USD and 1000 USD.
Luxury: Prices over 1000 USD.
Convert the pseudocode to a Python loop and show your Python code. Display the result as a category table, including related product names and customer names.
pseudocode for question-1
Initialize a counter i to 0
For each item in the list of prices: Retrieve the product name associated with the current item from the list of products Retrieve the customer name associated with the current item from the list of customers
If the price of the item is less than 50 USD:
Display a message indicating that it's a "Budget" purchase:
"Budget: Prices under 50 USD - Customer: [customer_name]- Product: [product_name]"
ElseIf the price is between 50 USD and 99 USD:
Display a message indicating it's an "Economy" purchase:
"Economy: Prices between 50 USD and 100 USD - Customer: [customer_name]- Product: [product_name]"
ElseIf the price is between 100 USD and 499 USD:
Display a message indicating it's a "Mid-Range" purchase:
"Mid-Range: Prices between 100 USD and 500 USD - Customer: [customer_name]- Product: [product_name]"
ElseIf the price is between 500 USD and 999 USD:
Display a message indicating it's a "Premium" purchase:
"Premium: Prices between 500 USD and 1000 USD - Customer: [customer_name]- Product: [product_name]"
Else:
Display a message indicating it's a "Luxury" purchase:
"Luxury: Prices over 1000 USD - Customer: [customer_name]- Product: [product_name]"
Increment the counter i by 1
End For

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions