Page 115 - Trackpad_V4.0_C8_Flipbook
P. 115
Oh, I found the error. You have
You can look at my program here placed an extra quote. I will explain
and tell me. I am not very good in you how and when to use single
writing code on Strings in Python. and double quotes with Strings.
Test Your Knowledge 21 st Century #Critical Thinking
#Technology Literacy
Skills
Write a Python code to add first five natural numbers using range() function.
A function is a block of organised and reusable code used to perform a single or related action. Functions
receive data in the form of arguments and use it to run a specified set of statements and produce the
final output.
FEATURES OF FUNCTION
Some important features of functions are:
A program is divided into small modules, and each module performs a specific task. Each module
can be called as per the requirement.
We can call a function as many times as required. This saves the programmer's time and effort to
rewrite the same code again. Therefore, it also reduces the length of the program.
Dividing a bigger program into smaller functions makes the program more manageable. It makes
debugging easy and makes the code efficient, both in terms of time and memory usage.
Functions and String in Python 113

