82 272
Assignments Done
99,5%
Successfully Done
In January 2020

# Answer to Question #28486 in Python for Daniel

Question #28486
How to write a program that counts rearrangements of a word in Python using recursion? Description: The letters of the word &quot;bookkeeper&quot; can be rearranged in 151,200 ways. Of course this is far too many to write them all down. However, there are formulas that allow us to count such things. The number of ways to rearrange n objects in a line is given by the formula n! = n(n &minus;1)(n &minus;2) ⋯ (2) 1 If m of the objects are indistinguishable, then for each distinct arrangement, there will be exactly m! indistinguishable rearrangements, so the total number is n!/m! In our problem, there are 10 letters (b, o, o, k, k, e, e, p, e, r), including 2 o&#039;s, 2, k&#039;s, and 3 e&#039;s. So the total number of rearrangements is 10! / 2!2!3! = (10 &sdot; 9 &sdot; 8 &sdot; 7 &sdot; 6 &sdot; 5 &sdot; 4 &sdot; 3 &sdot; 2 &sdot; 1) / (2 &sdot; 1)(2 &sdot; 1)(3 &sdot; 2 &sdot; 1) = 151,200 In this program, I need to write a recursive function to compute factorials, and use the function to count the number of rearrangements of the letters of words. I need two functions.
1

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!