You will write three small functions for binomial expansions: the general term, the value of a whole expansion, and the middle term numbers. The checker tests them on many cases.
The idea. The th term of is . Adding all the terms from to gives . The middle term numbers are for even , and and for odd .
Your tasks.
general_term(n, r, a, b). Return the value of the th term.expansion_value(n, a, b). Add the general terms for r from 0 to n.middle_terms(n). Return a list with the middle term number or numbers, in order.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…
With Standard, you also open 11 more problems, 2 Python labs and 1 extra course. Everything you have used here stays free, always.