Basics of Python
Introduction:
- Python is a high-level, interpreted programming language.
- It is known for its simplicity and readability.
- Python has a wide range of applications from web development to scientific computing.
1. Hello World Program:
- The traditional introduction to any programming language: printing "Hello, World!" to the console.
Example: 1
Output: 1
Hello, World!
2. Python Syntax:
- Python syntax is the set of rules that define how Python programs are written.
- Python uses indentation to indicate a block of code.
3. Python Indentation:
- Indentation is crucial in Python. It indicates a block of code under a statement.
- Other languages might use braces for this purpose, but Python uses indentation.
Example: 2
Output: 2
5
John
4. Comments in Python:
- Comments are used to describe the code. They are not executed.
- Python comments start with a #.
Example: 3
Output: 3
# Hey Python!