0% found this document useful (0 votes)
2 views8 pages

©© Programming Process & Python Programming 11 - 1

The document outlines the programming process, which includes steps from problem identification to maintenance, and introduces Python as a high-level programming language with various applications. It covers basic concepts such as variables, data types, control structures, loops, and functions, emphasizing their importance in programming. Additionally, it includes homework questions and activities to reinforce learning.

Uploaded by

1amanshivsharma
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)
2 views8 pages

©© Programming Process & Python Programming 11 - 1

The document outlines the programming process, which includes steps from problem identification to maintenance, and introduces Python as a high-level programming language with various applications. It covers basic concepts such as variables, data types, control structures, loops, and functions, emphasizing their importance in programming. Additionally, it includes homework questions and activities to reinforce learning.

Uploaded by

1amanshivsharma
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

©© Programming Process & Python Programming

---

© Chapter 1: Programming Process

©© What is Programming?

Programming is the process of writing instructions (called a **program**) that tell a computer
how to perform a specific task.

©© Steps in the Programming Process

©©© 1. Problem Identification

* Understand the problem clearly.


* Identify the required input and expected output.

©©© 2. Problem Analysis

* Study the problem carefully.


* Break it into smaller parts.

©©© 3. Algorithm Design

An **algorithm** is a step-by-step procedure for solving a problem.

**Characteristics of a Good Algorithm**

* Simple
* Clear
* Finite
* Efficient

©©© 4. Flowchart

A flowchart is a graphical representation of an algorithm.

**Common Symbols**

* Oval → Start/End
* Rectangle → Process
* Parallelogram → Input/Output
* Diamond → Decision
* Arrow → Flow of control

©©© 5. Coding

Write the program using a programming language such as Python.


©©© 6. Testing and Debugging

* Run the program.


* Find and remove errors (bugs).

©©© 7. Documentation

Prepare notes explaining how the program works.

©©© 8. Maintenance

Update and improve the program whenever required.

---

© Chapter 2: Introduction to Python

©© What is Python?

Python is a **high-level, interpreted, object-oriented programming language** developed by


**Guido van Rossum** in **1991**.

©©© Features of Python

* Easy to learn
* Free and open source
* Portable
* Object-oriented
* Large standard library
* Cross-platform
* Supports GUI programming

©©© Applications of Python

* Artificial Intelligence
* Machine Learning
* Data Science
* Web Development
* Automation
* Game Development
* Cyber Security

---

© Chapter 3: Basics of Python

©© Variables

Variables store data.

**Example**
```python
name = "Rahul"
age = 17
```

©© Rules for Naming Variables

* Must begin with a letter or underscore (_)


* Cannot begin with a number
* No spaces
* Case-sensitive

---

©© Data Types

* int → Integer
* float → Decimal number
* str → Text
* bool → True or False
* list → Collection of items
* tuple → Ordered collection (cannot be changed)
* dictionary → Key-value pairs

---

©© Input Function

```python
name = input("Enter your name: ")
```

---

©© Output Function

```python
print("Welcome")
```

---

©© Operators

©©© Arithmetic Operators

+, -, *, /, //, %, **

©©© Comparison Operators


==, !=, >, <, >=, <=

©©© Logical Operators

and, or, not

©©© Assignment Operators

=, +=, -=, *=

---

© Chapter 4: Control Structures and Loops

©© Decision Making

©©© if Statement

```python
age = 18

if age >= 18:


print("Eligible")
```

---

©©© if-else

```python
marks = 45

if marks >= 33:


print("Pass")
else:
print("Fail")
```

---

©©© if-elif-else

```python
marks = 82

if marks >= 90:


print("A+")
elif marks >= 75:
print("A")
else:
print("B")
```

---

©© Loops

©©© for Loop

Used when the number of repetitions is known.

```python
for i in range(5):
print(i)
```

Output

0
1
2
3
4

---

©©© while Loop

Used when repetitions depend on a condition.

```python
i=1

while i <= 5:
print(i)
i += 1
```

---

©© Loop Control Statements

©©© break

Terminates the loop.

©©© continue

Skips the current iteration.

©©© pass
Acts as a placeholder.

---

© Chapter 5: Functions

©© What is a Function?

A function is a block of reusable code that performs a specific task.

---

©© Advantages

* Code reusability
* Easy debugging
* Better readability
* Reduces repetition

---

©© Creating a Function

```python
def greet():
print("Good Morning")
```

Calling the Function

```python
greet()
```

---

©© Function with Parameters

```python
def add(a, b):
print(a + b)

add(10, 20)
```

---

©© Function with Return Value

```python
def square(n):
return n * n

result = square(5)
print(result)
```

---

©© Types of Functions

©©© Built-in Functions

* print()
* input()
* len()
* max()
* min()

©©© User-defined Functions

Functions created by the programmer.

---

© Summary

* Programming follows a systematic process from problem identification to maintenance.


* Python is simple, powerful, and widely used.
* Variables store data of different types.
* Control structures help make decisions.
* Loops repeat tasks efficiently.
* Functions improve code organization and reusability.

---

© Homework

©© A. Very Short Answer Questions

1. Define programming.
2. What is Python?
3. Name four features of Python.
4. What is a variable?
5. Name any four Python data types.

©© B. Short Answer Questions

1. Explain the steps in the programming process.


2. Differentiate between an algorithm and a flowchart.
3. Explain the difference between a for loop and a while loop.
4. Write the syntax of an if-else statement.
5. What are the advantages of functions?

©© C. Programming Questions

1. Write a program to print numbers from 1 to 20 using a for loop.


2. Write a program to check whether a number is even or odd.
3. Write a function to calculate the square of a number.
4. Write a program to find the largest of three numbers.
5. Write a function to calculate the sum of two numbers.

©© D. Activity

Draw the flowchart and write the algorithm for finding the largest of two numbers.

©© E. Project Work

Create a simple Python program that:

* Takes the student's name and marks as input.


* Calculates the percentage.
* Displays the grade using if-elif-else statements.
* Uses a user-defined function to display the result.

You might also like