Making three-digit numbers

Write code · Medium · §7.1 Trying them all

cards holds the digits written on number cards. You pick three of the cards, each card at most once, and put them in a row to make a three-digit number. The first digit cannot be 0.

Complete the function solution, which returns how many different three-digit numbers you can make. Several cards may have the same digit.

Function

solution(cards)

Constraints

Examples

cardsresult
[1, 2, 3]6
[0, 1, 1]2

Starter code

def solution(cards):
    answer = 0
    return answer

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.