(a, b)
| 1 | def last_digit(a, b): |
| 2 | if b == 0: # This Code assumes that 0^0 is 1 |
| 3 | return 1 |
| 4 | elif a % 10 in [0, 5, 6, 1]: |
| 5 | return a % 10 |
| 6 | elif b % 4 == 0: |
| 7 | return ((a % 10) ** 4) % 10 |
| 8 | else: |
| 9 | return ((a % 10) ** (b % 4)) % 10 |
| 10 | |
| 11 | |
| 12 | # Courtesy to https://brilliant.org/wiki/finding-the-last-digit-of-a-power/ |
nothing calls this directly
no outgoing calls
no test coverage detected