How to make a Profit Calculator using Python Program

Everybody loves profit. But what exactly is profit, how to calculate it? Let me help you! There are 3 parameters in calculating profit. So, let’s start!

Profit

Suppose you are a shopkeeper and you sell mobile phones. As you’re the shopkeeper you’ll not manufacture mobiles. There are several companies which manufacture phones for example Mi. If you’re selling phones you’ll buy in bulk to sell it to many customers. This is called the inventory or in simple words quantity of goods. As you’re purchasing in bulk you’ll get 1 mobile at a much lesser price. This less price is called the Cost Price. Now a customer or consumer comes to your shop and asks for a mobile XYZ. You will not sell the mobile at the price you bought.

In India, the Government sets a price for each product officially called the ‘MRP’ or Maximum Retail Price’ which is inclusive of all taxes. You can’t even charge a single extra penny over the MRP. However, you can give a discount! Suppose you bought 1 phone at 5000 Rs and the MRP is 7000. You Sold the product at the MRP so the MRP is the selling price. Profit is the difference between the cost price and the selling price. If the selling price is higher than the cost price then you’re profit else loss.

[blockquote align=”none” author=””]

Cost Price: The price for 1 product at which the shopkeeper purchases goods in bulk is called the cost price. 

Selling Price: The price at which the shopkeeper sells the goods is the Selling price.

See also  Create a Calculator using Python without Importing Modules

Inventory/Quantity/Stock: The amount of goods available right now is called the stock.

Formula: (SP(Selling Price) – CP(Cost Price)) * Inventory

[/blockquote]

For example:

CP = 5000 RS

SP = 7000 RS

Stock = 10 

Profit = (SP – CP) * Stock

=(7000 – 5000) * 10 

=2000 * 10 

=20000 RS

 

Code

Now let me explain to you how to do the same in Python. For this code, you’ll need to know Functions, Variables.

Prerequisites:  Python-Functions & Variables.

import time 

def sales_profit(sp , cp , q):

First, we’ve imported the ‘Time’ Module However,  why we’ve done so I’ll tell you later. After importing the module we’ve created a function ‘sales_profit’ and defined 3 variables ‘ cp, sp, q ’ for Cost price, Selling price, and Quantity respectively. 

 formula = str((sp - cp) * q)
    total_cp = str(q * cp)
    total_sp = str(q * sp)

The Statement part:

 print('For ' + str(q) + ' total cost price is ' + total_cp + ' rupees')
 print('For ' + str(q) + ' total selling price is ' + total_sp + ' rupees')

 print('Your total profit made is ' + formula + ' rupees')

This is nothing but the statement-making for the answer. It just returns the answer in sentences instead of just numbers!

: ALL CODE/>

def sales_profit(sp , cp , q):
    formula = str((sp - cp) * q)
    total_cp = str(q * cp)
    total_sp = str(q * sp)
    print('For ' + str(q) + ' total cost price is ' + total_cp + ' rupees')
    print('For ' + str(q) + ' total selling price is ' + total_sp + ' rupees')
    print('Your total profit made is ' + formula + ' rupees')

sales_profit(15, 10, 10)

Input 

sales_profit(15, 10, 10)

Output

For 10 total cost price is 100 rupees
For 10 total selling price is 150 rupees
Your total profit made is 50 rupees  

 

Also Read:

Get the factorial of a number in Python!

See also  How to Make ChatGPT to Do My Python Homework?

Calculate Area of Figures using Python

Find the Missing Number in 2 Ways Using Python

Latest

test

Voyager Scholarship: Voyager Scholarship 2025 Application, Enrollment & Tips

The Voyager Scholarship is an esteemed program that provides...

Spokeo Artificial Intelligence Scholarship 2024 Application, Enrollment & Tips

Artificial Intelligence (AI) has become an integral part of...

Pizza Hut Scholarship: Pizza Hut Scholarship 2024 Application, Enrollment & Tips

The Pizza Hut Scholarship Program is a post-high school...

Newsletter

Don't miss

test

Voyager Scholarship: Voyager Scholarship 2025 Application, Enrollment & Tips

The Voyager Scholarship is an esteemed program that provides...

Spokeo Artificial Intelligence Scholarship 2024 Application, Enrollment & Tips

Artificial Intelligence (AI) has become an integral part of...

Pizza Hut Scholarship: Pizza Hut Scholarship 2024 Application, Enrollment & Tips

The Pizza Hut Scholarship Program is a post-high school...
Vasav Trehan
Vasav Trehanhttps://technifyed.com
Vasav is the brain behind Technifyed.com. His love for Technology and Programming led him to kick-start this flabbergasting website and his Instagram account @technifyedofficial. His motive is to Simply Tech for Everyone.

test

Voyager Scholarship: Voyager Scholarship 2025 Application, Enrollment & Tips

The Voyager Scholarship is an esteemed program that provides financial aid, opportunities, and support to students aspiring to pursue a career in public service....

Spokeo Artificial Intelligence Scholarship 2024 Application, Enrollment & Tips

Artificial Intelligence (AI) has become an integral part of our modern world and is transforming various industries. As a result, several organizations are providing...