You are given n successive discounts in percentages. Your task is to find the equivalent discount in percentage. Input will contain a list in which each element of the list will be discount in percentage that will be negative in sign.
Input : a = [-10, -35, -60, -75] Output : -94.14 Input : a = [-5, -20, -10.-23] Output : -49.08
SUCCESSIVE CHANGES = A + B + (A*B) / 100
How does this formula work?
Let x be the initial value. After A% change, value of x becomes (x + x*A/100). After successive B% change, value of x becomes (x + x*A/100) + (x + x*A/100)*B/100. So increment in x’s value is x*(A + B + A*B/100)/100. In terms of percentage, we can say that the value is incremented by (A + B + A*B/100)%
- Simply, apply sucessive change formula between arr and arr and store the result in result variable.
- Now, calculate successive change between result and arr using the above formula and store the result in result variable and so on.
Code: Python program for finding the equivalent discount in successive discounts in percentages.
- Python - Successive element pairing
- Python | Generate successive element difference list
- numpy.find() in Python
- Python String | find()
- Python | Find who tweeted the most
- Find Median of List in Python
- Python program to find the first day of given year
- Python program to find all possible pairs with given sum
- Python | Find maximum value in each sublist
- Python | Find all triplets in a list with given sum
- Python program to find IP Address
- Find size of a list in Python
- Python | sympy.find() method
- Python | Find the closest Key in dictionary
- Python | Find depth of a dictionary
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.