B01C-2015D – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12D-2015-B01C #PYTHON#6509    siteicon   siteicon  

Problem Statement - B01C-2015D

Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

def Tot(Number) #Method to find Total
    Sum=0
    for C in Range (l, Number+l):
        Sum+=C
RETURN Sum

print Tot[3]    #Function Calls
print Tot[6]

Solution

TC++ #6509

def Tot(Number) : #Method to find Total   #Error 1
    Sum=0
    for C in range (1, Number+1):         #Error 2
        Sum+=C
    return Sum                            #Error 3
print Tot (3) #Function Call              #Error 4
print Tot (6)                             #Error 4


Share

CSKC| Created: 12-Jan-2019 | Updated: 12-Jan-2019|CBSE12D-2015









Back