Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Function Definition**: Define a function calculate_discount(price, discount_percent) that takes two parameters: the original price and the discount percentage. 2. Discount Check: Inside the function, check if the discount percentage is 20% or higher. 3. Calculate Final Price: If the discount condition is met, calculate the final price by applying the discount. The discount amount is calculated as price * (discount_percent / 100), and the final price is price - discount_amount. 4. Return Result: Return the final price after discount if applicable; otherwise, return the original price. 5. User Input Handling: Prompt the user to enter the original price and discount percentage. Convert these inputs to floating-point numbers for calculations. 6. Output Result: Call the function with the user inputs and print the result formatted to two decimal places. 7.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages