CBSE Class 12 Computer Science
Question 69 of 103
Working with Functions — Question 2
Back to all questionsdef Tot(Number): #Method to find Total
Sum = 0
for C in range(1, Number + 1):
Sum += C
return Sum
print(Tot(3)) #Function Calls
print(Tot(6))6
21
- There should be a colon (:) at the end of the function definition line to indicate the start of the function block.
- Python's built-in function for generating sequences is
range(), not Range(). - Python keywords like
returnshould be in lowercase. - When calling a function in python, the arguments passed to the function should be enclosed inside parentheses () not square brackets [].