0% found this document useful (0 votes)
23 views10 pages

Working With Functions Slides

The document provides an overview of functions in programming, highlighting their definition, advantages, and structure. It explains the difference between parameters and arguments, types of parameters, and various function types. Key takeaways emphasize the importance of functions for code organization and reusability, along with the need to understand parameter types and scopes.

Uploaded by

raghul muthuvel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views10 pages

Working With Functions Slides

The document provides an overview of functions in programming, highlighting their definition, advantages, and structure. It explains the difference between parameters and arguments, types of parameters, and various function types. Key takeaways emphasize the importance of functions for code organization and reusability, along with the need to understand parameter types and scopes.

Uploaded by

raghul muthuvel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Working with Functions

CBSE Class 12 Computer Science


Pradnya's Class

Page 1
What is a Function?

A function is a subprogram that acts on data and often returns a value.


Functions promote modularity, readability, reusability, and manageable code.

Page 2
Advantages of Functions

- Breaks big problems into smaller ones


- Avoids ambiguity
- Reduces code size
- Improves readability and enhances reusability

Page 3
Arguments vs Parameters

- Parameters: Placeholders in function definitions (formal)


- Arguments: Actual values passed during function calls (actual)

Page 4
Types of Parameters

- Positional (required): Matched by position


- Default parameters: Predefined values
- Keyword (named): Passed by name, order does not matter

Page 5
Structure of a Function

- Header: def name(params):


- Body: Indented statements
- Optional return statement
- Call using name(args)

Page 6
Function Types

- Void functions: No return value


- Non-void functions: Return a value
- Built-in functions: Already available
- Module functions: From imported modules
- User-defined functions: Created by the user

Page 7
Parameter Passing Basics

- Mutable vs Immutable
- Scope: Local vs Global variables
- Use of global keyword

Page 8
Code Examples

- Example of positional, default, and keyword arguments


- Void vs return-value functions
- Global scope variable usage example

Page 9
Summary & Key Takeaways

- Functions make code reusable and organized


- Understand parameter types and scopes
- Practice with different examples and use cases

Page 10

You might also like