Question: intro level python/data programming here is the solution to problem 4 (body of the loop) Problem 5: Multiple factorials Write code to print the first

intro level python/data programming
intro level python/data programming here is the solution to problem 4 (body
here is the solution to problem 4 (body of the loop)
of the loop) Problem 5: Multiple factorials Write code to print the

Problem 5: Multiple factorials Write code to print the first 10 factorials, in reverse order. In other words, write code that prints 101, then prints 91, then prints 81, ..., then prints 1!. Its literal output will be: 101: 3628800 91: 362880 81: 40320 7!: 5040 61: 720 51: 120 41: 24 31:6 21 : 2 11: 1 The first line of your solution should assign a variable num lines to 10. Then, as in Problems 3 and 4, the rest of the code should print the correct number of lines and correct factorial on each line for values other than 10 just by setting num_lines to a different value. Hint: Use two nested for loops. The outer loop sets the value of n to the values num_lines, num lines-1, num_lines-2, ..., 1, in succession. Then, the body of that loop is itself a loop - exactly your solution to Problem 4. Factorial", without the first line n- 10 that hard-codes the value of n. Problem 6: Sums of reciprocals of factorials Compute the following value: 1+1/11+1/21 + 1/31+1/41+ ... + 1/101 The value should be close to e(2.71828), the base of the natural logarithms. Like with the previous few problems, you should use a variable n - 10 to determine how many fractions to add. In theory, increasing this number should get you closer to the true value of e. Hint: The easiest way to solve this is with two nested for loops. It is possible, but tricky, to compute this using only one for loop. That is not necessary for this assignment Hint: Copy your solution to "Problem 5: Multiple factorials", then modify it. Rather than printing the factorials, you will add their reciprocals to a running total, then print that total at the end. Hint: don't try to work the very first "1+" into your loop; do it outside the loops (either at the very beginning or the very end of the outer loop). . 5 5 n = 10 factorial = 1 for i in range(1, n+1): factorial *= i print("Factorial number",n,"via loop!", factorial) 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!