PREREQUISITES
To Practice this Program, you should have a basic knowledge of the following Topics:
WHAT TO DO ?
Given,
Potato : 10Rs/Kg , Tomato : 20Rs/Kg , Onion : 30Rs/Kg
Ask User Qty in Kgs for each item above
And Calculate its final bill after 10% discount & 50Rs Delivery Charges.
HOW TO DO ?
Following are the steps to do :
</p>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>potato = 10
tomato = 20
onion = 30
print("How much qty do you want to purchase for the following items ? ")
potato_qty = int(input("Potato(in Kgs) : "))
tomato_qty = int(input("Tomato(in Kgs) : "))
onion_qty = int(input("Onion(in Kgs) : "))
</pre>
</div>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>cart_value = potato * potato_qty + tomato * tomato_qty + onion * onion_qty
print("CART VALUE " + str(cart_value))
</pre>
</div>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>discount = cart_value*0.10
print("Less Discount " + str(discount))
delivery = 50
print("Add Delivery Charges " + str(delivery))
final_bill = cart_value - discount + delivery
print("Your final bill is " + str(final_bill))</pre>
</div>
Things We Covered
- Accepting User Data (Input Function)
- Integer/String Conversion (Int/Str Function)
- Calculations (Arithmetic Operators)
Posted by Akshay Gupta
