0% found this document useful (0 votes)
4 views

Assignment First Version

Uploaded by

JS K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Assignment First Version

Uploaded by

JS K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

product_1_name = str(input("Please enter the name of first product:"))

product_1_quantity = int(input("Please enter the quantity of first product:"))

product_1_price = int(input("Please enter the price of the first product:"))

product_1_sales = int(input("Please enter the sales of the first product(how many items were
sold):"))

product_1_revenue = product_1_sales * product_1_price

product_1_remaining_quantity = product_1_quantity - product_1_sales

print("The remaining quantity of product 1 is:", product_1_remaining_quantity)

Product_1 = [product_1_name, product_1_quantity, product_1_price, product_1_sales,


product_1_revenue, product_1_remaining_quantity]

print (Product_1)

product_2_name = str(input("Please enter the name of second product"))

product_2_quantity = int(input("Please enter the quantity of second product"))

product_2_price = int(input("Please enter the price of the second product"))

product_2_sales = int(input("Please enter the sales of the second product(how many items were
sold):"))

product_2_revenue = product_2_sales * product_2_price

product_2_remaining_quantity = product_2_quantity - product_2_sales

print("The remaining quantity of product 2 is:", product_2_remaining_quantity)

Product_2 = [product_2_name, product_2_quantity, product_2_price, product_2_sales,


product_2_revenue, product_2_remaining_quantity]

print (Product_2)

product_3_name = str(input("Please enter the name of third product"))

product_3_quantity = int(input("Please enter the quantity of third product"))

product_3_price = int(input("Please enter the price of the third product"))

product_3_sales = int(input("Please enter the sales of the third product(how many items were
sold):"))

product_3_revenue = product_3_sales * product_3_price

product_3_remaining_quantity = product_3_quantity - product_3_sales


print("The remaining quantity of product 3 is:", product_3_remaining_quantity)

Product_3 = [product_3_name, product_3_quantity, product_3_price, product_3_sales,


product_3_revenue, product_3_remaining_quantity]

print (Product_3)

import pandas as pd

data = {

"Name" : [product_1_name, product_2_name, product_3_name],

"Quantity" : [product_1_quantity, product_2_quantity, product_3_quantity],

"Price" : [product_1_price, product_2_price, product_3_price],

"Sales" : [product_1_sales, product_2_sales, product_3_sales],

"Revenue" : [product_1_revenue, product_2_revenue, product_3_revenue],

"Remaining_Quantity" : [product_1_remaining_quantity, product_2_remaining_quantity,


product_3_remaining_quantity]

df = pd.DataFrame(data)

print("\nData table is\n", df)

import matplotlib.pyplot as plt

plt.bar(df["Name"], df["Remaining_Quantity"], color = 'skyblue')

plt.xlabel("Product Name")

plt.ylabel("Remaining Quantity of product")

plt.title("Remaining Quantity")

total_revenue = product_1_revenue + product_2_revenue + product_3_revenue

print("The total revenue generated from all sales is:", total_revenue)

You might also like