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

Your Handwritten Python Ch3 Notes Typed

Chapter 3 of Class 11 Informatics Practices covers Python programming fundamentals including expressions, statements, comments, input/output functions, and types of operators. It explains conditional statements with examples and discusses common errors in Python such as syntax, runtime, and logical errors. The chapter also highlights operator precedence and provides sample programs for practical understanding.

Uploaded by

Vaseegaran
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 views4 pages

Your Handwritten Python Ch3 Notes Typed

Chapter 3 of Class 11 Informatics Practices covers Python programming fundamentals including expressions, statements, comments, input/output functions, and types of operators. It explains conditional statements with examples and discusses common errors in Python such as syntax, runtime, and logical errors. The chapter also highlights operator precedence and provides sample programs for practical understanding.

Uploaded by

Vaseegaran
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
You are on page 1/ 4

Class 11 Informatics Practices - Chapter 3: Python Programming Fundamentals (Typed from

Handwritten Notes)

---

1. Expressions and Statements

- An expression is a combination of values, variables, and operators that evaluates to a value.

Example: 5 + 3, a * b

- A statement is an instruction to perform a specific action. Example: x = 5, print("Hello")

---

2. Comments

- Used to explain code; ignored by Python

- Single-line comment: starts with #

- Multi-line comments: triple single quotes ('''comment''') or triple double quotes ("""comment""")

---

3. Input and Output Functions

- input(): Accepts user input as a string

- print(): Displays output

---

4. Types of Operators
- Arithmetic Operators: +, -, *, /, //, %, **

- Relational Operators: ==, !=, >, <, >=, <=

- Logical Operators: and, or, not

- Assignment Operators: =, +=, -=, *=, etc.

---

5. Operator Precedence

1. Parentheses ()

2. Exponentiation **

3. Unary + and -

4. *, /, //, %

5. +, -

6. Relational operators

7. Logical not

8. Logical and

9. Logical or

---

6. Conditional Statements

- if statement: Checks a condition and executes block if true

if condition:

# code block

- if-else statement: Executes one block if condition is true, another if false


if condition:

# true block

else:

# false block

- if-elif-else: Used for multiple conditions

if condition1:

# block1

elif condition2:

# block2

else:

# default block

---

7. Sample Programs

1. Check if number is positive or negative

num = int(input("Enter a number: "))

if num > 0:

print("Positive")

else:

print("Negative")

2. Check if number is even or odd

num = int(input("Enter a number: "))


if num % 2 == 0:

print("Even")

else:

print("Odd")

3. Grading system

marks = int(input("Enter your marks: "))

if marks >= 90:

print("Grade A")

elif marks >= 70:

print("Grade B")

elif marks >= 50:

print("Grade C")

else:

print("Fail")

---

8. Errors in Python

- Syntax Error: Code violates Python grammar rules

- Runtime Error: Error that occurs during execution

- Logical Error: Output is incorrect, even if code runs

---

End of Chapter 3 Notes

You might also like