Class 9 - Introduction to Python
About Python
• Python was created by Guido van Rossum in 1991.
• Python is a high-level programming language.
• It is interpreted and platform-independent.
• It supports Object Oriented Programming.
Python File & Execution
• File extension of Python: .py
• Executed by Python Interpreter.
• Two modes: Interactive Mode and Script Mode.
Important Functions
• print() → Display output
• input() → Take user input (returns string)
• type() → Check data type
Data Types
• int → Whole numbers
• float → Decimal numbers
• string → Text inside single or double quotes
• boolean → True / False
Variables Rules
• A variable is a name given to a memory location.
• Cannot start with a number.
• Variable names are case sensitive.
Operators
• + → Addition and Concatenation
• // → Floor Division (removes decimal part)
• = → Assignment Operator
Errors in Python
• Syntax Error → Grammar mistake.
• Runtime Error → Error during execution.
Comments
• Written using # symbol.
• Ignored by interpreter.
• Improve readability of code.