• 1
    Input and Output Data
    • Tasks
  • 2
    Conditions
    • Tasks
  • 3
    For Loop
    • Tasks
  • 4
    Strings
    • Tasks
  • 5
    While Loop
    • Tasks
  • 6
    Lists
    • Tasks
  • 7
    Two-Dimensional Arrays
    • Tasks
  • 8
    Dictionaries
    • Tasks
  • 9
    Sets
    • Tasks
  • 10
    Functions and Recursion
    • Tasks
  • к

Lesson 10. Functions and recursion

Difficulty level:

Task«Discount management system in the store»

💻 Python
The system of automatic calculation of discounts for different categories of goods operates in a large shopping center. The administrator can create new types of discounts by setting a basic discount and additional conditions. The system should be able to create features-calculators of discounts based on the specified parameters.
rn
you need to create a program that creates in the input parameters The function of calculating the final price of the goods. The program receives the type of discount, the basic percentage of discounts, the minimum amount for the use of discounts and a list of goods with prices. Then he applies the created function to all goods and displays the final prices.

Input format

The first line contains the type of discount (Linear, Progressive, Threshold). 14pt; "> The second line contains the basic percentage of discounts (an integer from 0 to 50).
The third line contains the minimum amount for the use of discounts (an integer). 14pt; "> The fourth line contains the amount of goods.
Further lines with the prices of goods (integers)

Output format

The final prices of goods after applying the discount, sorted by increasing, each price on a new line. Prices are rounded to entire numbers

Example

Input

linear
10
100
3
150
200
80

Output

80
135
180

Hint

There will be no clue here, decide for yourself!

main.py
Test 1
Test 2
Test 3
Test 4
Test 5
Test 6
Test 7
Test 8
Test 9
Test 10
Developer’s solution

🎉 Congratulations! 🎉

You did an excellent job with the task! It was a challenging problem, but you found the correct solution. You are one step closer to mastering programming! Keep up the good work, because every stage you pass makes you even stronger.

AD

Advertisement

red-snake blue-snake green-snake

Running your code...

AI Helper

Hi! I am your programming assistant. Ask me anything about Python — I can explain functions, methods, and help you understand the current task!