Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sum of n factorials: The following function sum _ fact ( num ) , attempts to calculate the sum of factorials of all the numbers

Sum of n factorials: The following function sum_fact(num), attempts to calculate the sum of factorials of all the numbers from 1 to n. For example sum_fact (5)=1!+2!+3!+4!+5153
Identify and correct the errors in the following function:
def sum_fact (n) :
sum =0
for i in range 1,n+1 :
fact =0
for j in rnge 1,n+1 :
fact **=j
sum += fact
return sum
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

=+such as the dirigenti in Italy?

Answered: 1 week ago

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago