This is a Python program that calculates discount amount and discounted rate for which you get the product for sale.
Variables Used:- price: Actual price of the product.
- discount_percentage: Datatype float : Discount % on the product.
- discount_amount: Datatype float : Discount Amount on the product.
- discounted_price: Datatype float : Discounted price that you pay.
Discount Amount = (Discount Percentage x Price)/100
Discounted Price = Price - Discount Amount
Sample Program code: discountCalculator.py
price = 1000;
discount_percentage = 5.99;
discount_amount = 0;
discounted_price = 0;
discount_amount = (discount_percentage*price)/100;
discounted_price = (price-discount_amount);
print("Discount Amount: ", discount_amount);
print("Discounted Price: ", discounted_price);
Output:
Discount Amount: 59.9
Discounted Price: 940.1
More Posts related to Python,
- Read JSON File in Python Program
- Convert Float to String in Python
- Python - Convert float to String
- Check if String Contains a Substring - Python
- Install and Run Jupyter Notebook on Mac (macOS)
- Sorting an array using Bubble Sort in Python Programming
- Comments in Python Programming
- 3 Python program to add two numbers
- Read a file line by line in Python Program
- How to uninstall pip Python packages
- Change label (text) color in tkinter
- 7 Python Arithmetic Operators with Examples [Tutorial]
- pip get list of all outdated Python packages
- Where does brew install python in macOS
- How to Convert String to DateTime in Python
- Python: Fix command not found pip or pip3 on zsh shell
- How to add borders to tkinter label text
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- TypeError: must be str, not int
- Python Program To Calculate Simple Interest (SimpleInterest.py)
- Check version of pip package installer for Python
- Change the background of Tkinter label or text
- Set width and height for the label in tkinter
- How to write JSON file in Python Program
- Python raise error with message example
More Posts:
- Android SecurityException: Need BLUETOOTH ADMIN permissicacheNameAndAddresson: Neither user 10123 nor current process has android.permission.BLUETOOTH_ADMIN - Android
- java.lang.NoClassDefFoundError android.support.v4.content.LocalBroadcastManager - Android
- Read Text file from SD Card : Android Programming - Android
- Struts2 : java.lang.ClassNotFoundException: org.apache.commons.fileupload.RequestContext - Java
- How to know your Mac Screen Resolution? - MacOS
- BSNL Broadband upgrades speed to minimum 2MBps for all users 512Kbps 1Mbps - HowTos
- Android AlertDialog with 3 buttons example - Android
- How to Disable EditText Keyboard Android App - Android