Menu
Coddy logo textTech

BlackJack

Lesson 8 of 12 in Coddy's Python Interview Series course.

challenge icon

Challenge

Medium

Write a function blackjack that gets,

  • a1 - integer
  • a2 - integer
  • a3 - integer

Given three integers between 1 and 11,If their sum is less than or equal to 21, return their sum. 

If their sum exceeds 21 and there's an eleven, reduce the total sum by 10. 

Finally, if the sum (even after adjustment) exceeds 21, return 'BUST'

 


Example:

Input - 5,6,7

Expected Output - 18

Try it yourself

def blackjack(a1, a2, a3):
    # Write code here

All lessons in Python Interview Series