🐍 Python Notes – Chapter 1: Basics + Practice
📄 1) first.py
– First Program
🧠 Concepts Covered:
print()
function
- Single-line and multi-line comments
📜 Code:
print("HELLO WORLD") # Prints Hello World to the console
# First program
""" This is a
Multiple line comment """
# You can also comment multiple lines by selecting them and pressing Ctrl+/
# Cool
# Awesome
# Fun
📝 Explanation:
print("HELLO WORLD")
: Basic output command in Python.
#
: Used for single-line comments.
""" """
or ''' '''
: Used for multi-line comments or docstrings.
- Shortcut for commenting multiple lines at once:
Ctrl + /
in most editors (like VS Code).
📦 2) Module.py
– Using External Modules
🧠 Concepts Covered:
- Importing modules
- Using
pip
to install external libraries
📜 Code:
# Use PIP INSTALL (MODULE NAME) to install a module
import pyjokes
print("Sure, here is your joke")
# This prints a random joke
joke = pyjokes.get_joke()
print(joke)