Screen Link: Learn data science with Python and R projects

My Code:

```
def probability_less_6(n_winning_numbers):
n_combinations_ticket = combinations(6, n_winning_numbers)
n_combinations_remaining = combinations(43, 6 - n_winning_numbers)
successful_outcomes = n_combinations_ticket * n_combinations_remaining
n_combinations_total = combinations(49,6)
probability = successful_outcomes / n_combinations_total
probability_percentage = probability * 100
combinations_simplified = round(n_combinations_total/successful_outcomes)
print('''Your chances of having {} winning numbers with this ticket are {:.6f}%.
In other words, you have a 1 in {:,} chances to win.'''.format(n_winning_numbers, probability_percentage, int(combinations_simplified)))
```

n_combinations_remaining = combinations(43, 6 - n_winning_numbers)

why it needs to use 6 minus n_winning_numbers?

Here’s the guideline:

- First, calculate the number of successful outcomes given the value of the input. We already covered how to calculate this when the input is
`5`

— when the input is lower, we need to take the same approach (but be careful, the number of combinations will vary). If you get stuck, try to sneak a look at the solution notebook. - Second, calculate the number of total possible outcomes.

Best,

Jessie