Computer Science Class 11 - Chapter 3 Notes
Flowchart Symbols
- **Terminator (Start/End):** Represented by an oval. Marks the beginning or end of a flowchart.
- **Process:** Rectangle shape. Used for calculations, operations, or any processing step.
- **Input/Output:** Parallelogram shape. Denotes data input (like reading from user) or output (displaying results).
- **Decision:** Diamond shape. Used for decision-making steps (e.g., yes/no, true/false conditions).
- **Flowlines:** Arrows that show the sequence and direction of the flow of the process.
- **Connector:** Small circle. Used to connect parts of the chart or continue on a new page.
Steps to Create Flowchart
1. **Understand the problem:** Know the steps or logic you want to represent.
2. **Identify the Start and End points.**
3. **List all the major steps or actions involved.**
4. **Use standard flowchart symbols to represent each action.**
5. **Connect symbols with arrows to show the flow of logic.**
6. **Check for decisions and add diamond symbols appropriately.**
7. **Review the flowchart for completeness and correctness.**
8. **Use software tools or draw neatly if on paper.**
Pseudocode
- Pseudocode is a method of designing algorithms using structured but readable text.
- It's written in simple English with no strict syntax.
- Helps programmers plan the structure before actual coding.
- Example: Making a phone call
1. Start
Computer Science Class 11 - Chapter 3 Notes
2. Unlock the phone
3. Open contacts app
4. Search for contact
5. Press call button
6. Talk
7. End the call
8. Stop
Python Introduction
- **High-level programming language** created by Guido van Rossum in 1991.
- Named after the comedy show 'Monty Pythons Flying Circus'.
- Easy to learn and use with clear syntax and readability.
- Supports multiple programming paradigms (procedural, object-oriented, functional).
- Open-source and community-driven.
- Widely used in web development, AI, data science, automation, and more.
Advantages of Python
1. **Easy to Learn and Use:** Clear and concise syntax.
2. **Cross-Platform:** Runs on Windows, Mac, Linux, etc.
3. **Extensive Standard Library:** Includes modules for file I/O, regular expressions, networking, etc.
4. **Object-Oriented:** Supports classes and objects.
5. **Large Community Support:** Easier to find help and resources.
6. **Supports GUI Programming:** With modules like Tkinter, PyQt.
7. **Ideal for Prototyping and Rapid Development.**
Computer Science Class 11 - Chapter 3 Notes
Limitations of Python
1. **Slower Execution:** Interpreted language, not as fast as compiled ones like C++.
2. **Not Ideal for Mobile Development:** Few mobile apps are built using Python.
3. **High Memory Usage:** Not suitable for memory-intensive applications.
4. **Weak in Database Access:** Not as robust as JDBC or ODBC.
5. **Runtime Errors:** Dynamically typed, so type errors may appear only during execution.
Installing Python
- Go to the official Python website: [Link]
- Download the latest Python 3.x version (e.g., 3.6.5).
- During installation, check the box to add Python to system PATH.
- Install IDLE: Comes by default, it's the Python shell and editor.
- Verify installation by typing `python` in Command Prompt or Terminal.
Using Python Shell
- Also known as Interactive Mode.
- You see the prompt `>>>` where you can type and immediately run Python code.
- Useful for quick testing, calculations, and learning.
- Example:
>>> print('Hello')
Hello
>>> 2 + 3
5
Computer Science Class 11 - Chapter 3 Notes
First Python Program
- A typical first program prints a message:
```python
print('Hello World')
```
- Remember:
- Python is **case-sensitive** (e.g., Print != print)
- Statements must follow indentation and syntax rules.
- Strings must be in quotes.
Math in Python
- You can perform math operations using Python like a calculator.
- Use operators: +, -, *, /, %, //, **
- Example:
```python
print(5 + 3)
print(10 // 3)
```
- You can combine text and values using commas in print: ```python
print('Sum is', 5 + 3)
```
Python Features Summary
- **Interpreted:** No compilation needed.
Computer Science Class 11 - Chapter 3 Notes
- **Interactive:** Immediate execution and feedback.
- **Object-Oriented:** Supports class, object, inheritance.
- **Portable:** Write once, run anywhere.
- **Extensible:** Can integrate C/C++ code.
- **Easy Syntax:** Improves developer productivity.
- **Wide Applications:** Web, AI, ML, games, etc.
Pseudocode Example - Average Marks
```
Set total = 0
Repeat 10 times:
Input marks
total = total + marks
Average = total / 10
Display Average
```
Name Input Example
- Pseudocode:
1. Input username
2. Output Hello username
- Python Code:
```python
name = input('Enter your name: ')
Computer Science Class 11 - Chapter 3 Notes
print('Hello', name)
```
Decomposition
- Technique of breaking complex problems into smaller, manageable parts.
- Each part is solved separately and then combined.
- Helps in easier debugging and understanding of logic.
- Useful in both programming and algorithm design.
Starting Python
- After installation, go to Start > IDLE (Python GUI).
- You will see the Python shell (>>> prompt).
- To write multi-line code, go to File > New File (Editor Mode).
- Save the file with `.py` extension and run using F5.