Algorithms
Easy
2806
2955
Account Balance After Rounded Purchase
account-balance-after-rounded-purchase
"""
Initially, you have a bank account balance of 100 dollars.

You are given an integer purchaseAmount representing the amount you will spend on a purchase in dollars.

At the store where you will make the purchase, the purchase amount is rounded to the nearest multiple of 10. In other words, you pay a non-negative amount, roundedAmount, such that roundedAmount is a multiple of 10 and abs(roundedAmount - purchaseAmount) is minimized.

If there is more than one nearest multiple of 10, the largest multiple is chosen.

Return an integer denoting your account balance after making a purchase worth purchaseAmount dollars from the store.

Note: 0 is considered to be a multiple of 10 in this problem.

Example 1:

Input: purchaseAmount = 9
Output: 90
Explanation: In this example, the nearest multiple of 10 to 9 is 10. Hence, your account balance becomes 100 - 10 = 90.

Example 2:

Input: purchaseAmount = 15
Output: 80
Explanation: In this example, there are two nearest multiples of 10 to 15: 10 and 20. So, the larger multiple, 20, is chosen.
Hence, your account balance becomes 100 - 20 = 80.


Constraints:

 * 0 <= purchaseAmount <= 100
"""
class Solution:
    def accountBalanceAfterPurchase(self, purchaseAmount: int) -> int:
        
Initially, you have a bank account balance of 100 dollars.

You are given an integer purchaseAmount representing the amount you will spend on a purchase in dollars.

At the store where you will make the purchase, the purchase amount is rounded to the nearest multiple of 10. In other words, you pay a non-negative amount, roundedAmount, such that roundedAmount is a multiple of 10 and abs(roundedAmount - purchaseAmount) is minimized.

If there is more than one nearest multiple of 10, the largest multiple is chosen.

Return an integer denoting your account balance after making a purchase worth purchaseAmount dollars from the store.

Note: 0 is considered to be a multiple of 10 in this problem.

Example 1:

Input: purchaseAmount = 9
Output: 90
Explanation: In this example, the nearest multiple of 10 to 9 is 10. Hence, your account balance becomes 100 - 10 = 90.

Example 2:

Input: purchaseAmount = 15
Output: 80
Explanation: In this example, there are two nearest multiples of 10 to 15: 10 and 20. So, the larger multiple, 20, is chosen.
Hence, your account balance becomes 100 - 20 = 80.


Constraints:

 * 0 <= purchaseAmount <= 100


Please complete the code below to solve above prblem:
```python
class Solution:
    def accountBalanceAfterPurchase(self, purchaseAmount: int) -> int:
        
```

my_solution = Solution()

test_input = { "purchaseAmount": 9 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 15 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 10 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 11 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 12 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 13 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 14 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 16 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 17 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 18 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 19 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 1 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 100

test_input = { "purchaseAmount": 2 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 100

test_input = { "purchaseAmount": 3 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 100

test_input = { "purchaseAmount": 4 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 100

test_input = { "purchaseAmount": 5 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 6 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 7 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 8 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 90

test_input = { "purchaseAmount": 20 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 21 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 22 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 23 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 24 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 80

test_input = { "purchaseAmount": 25 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 26 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 27 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 28 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 29 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 30 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 31 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 32 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 33 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 34 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 70

test_input = { "purchaseAmount": 35 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 36 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 37 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 38 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 39 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 40 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 41 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 42 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 43 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 44 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 60

test_input = { "purchaseAmount": 45 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 46 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 47 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 48 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 49 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 50 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 51 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 52 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 53 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 54 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 50

test_input = { "purchaseAmount": 55 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 56 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 57 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 58 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 59 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 60 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 61 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 62 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 63 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 64 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 40

test_input = { "purchaseAmount": 65 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 66 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 67 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 68 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 69 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 70 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 71 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 72 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 73 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 74 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 30

test_input = { "purchaseAmount": 75 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 76 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 77 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 78 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 79 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 80 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 81 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 82 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 83 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 84 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 20

test_input = { "purchaseAmount": 85 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 86 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 87 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 88 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 89 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 90 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 91 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 92 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 93 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 94 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 10

test_input = { "purchaseAmount": 95 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 0

test_input = { "purchaseAmount": 96 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 0

test_input = { "purchaseAmount": 97 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 0

test_input = { "purchaseAmount": 98 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 0

test_input = { "purchaseAmount": 99 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 0

test_input = { "purchaseAmount": 100 }
assert my_solution.accountBalanceAfterPurchase(**test_input) == 0