Discount Calculator
Calculate discount and final price.
BeginnerPhase 6 - Category 5: Real-World Logic ProblemsExample 9 of 15
discount-calculator.py
1# Take inputs2price = float(input("Enter price: "))3discount_percent = float(input("Enter discount (%): "))45# Calculate6discount_amount = (price * discount_percent) / 1007final_price = price - discount_amount89print(f"Original price: {price:.2f}")10print(f"Discount ({discount_percent}%): {discount_amount:.2f}")11print(f"Final price: {final_price:.2f}")
Output
Enter price: 1000 Enter discount (%): 20 Original price: 1000.00 Discount (20%): 200.00 Final price: 800.00
What's going on
Calculate discount and final price.
Key Concepts:
Discount = (price * discount%) / 100
Final price = price - discount
Simple calculation
🔗Related Content
- 📖
Phase 6 - Learn Concepts
Review Phase 6 concepts and explanations
- 📝
Phase 6 - Quiz
Test your Phase 6 understanding with quiz questions
- 💻
Phase 6 - All Practice Problems
Explore all practice problems for Phase 6
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum