0% found this document useful (0 votes)
3 views3 pages

Python NoteBook

Chapter 1 introduces Python programming concepts including modules, comments, and the PIP package manager. It explains the difference between built-in and external modules, how to use Python as a calculator, and the types of comments in Python. The chapter concludes with a practice set of exercises to reinforce the concepts learned.

Uploaded by

known4nope
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Python NoteBook

Chapter 1 introduces Python programming concepts including modules, comments, and the PIP package manager. It explains the difference between built-in and external modules, how to use Python as a calculator, and the types of comments in Python. The chapter concludes with a practice set of exercises to reinforce the concepts learned.

Uploaded by

known4nope
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CHAPTER 1 – MODULES, COMMENTS & PIP

print("hello world") # print is a function (more later)


Execute this file (.py file) by typing python hello.py and you will see Hello World
printed on the screen.

MODULES
A module is a file containing code written by somebody else (usually) which can
be imported and used in our programs.

PIP
Pip is the package manager for python. You can use pip to install a module on your
system.
pip install flask # Installs Flask Module

TYPES OF MODULES
There are two types of modules in Python. 1. Built in Modules (Preinstalled in
Python) 2. External Modules (Need to install using pip) Some examples of built in
modules are os, random etc. Some examples of external modules are tensorflow,
flask etc.

USING PYTHON AS A CALCULATOR


We can use python as a calculator by typing “python” + ↵ on the terminal. This
opens REPL or Read Evaluate Print Loop.

COMMENTS
Comments are used to write something which the programmer does not want to
execute. This can be used to mark author name, date etc.

TYPES OF COMMENTS
There are two types of comments in python.
1. Single Line Comments: To write a single line comment just add a ‘#’ at the
start of the line.
# This is a Single-Line Comment
2. Multiline Comments: To write multi-line comments you can use ‘#’ at each
line or you can use the multiline string (""" """)
"""This is an amazing
example of a Multiline
comment!"""
CHAPTER 1 – PRACTICE SET
1. Write a program to print Twinkle twinkle little star poem in python. 2. Use REPL
and print the table of 5 using it. 3. Install an external module and use it to perform
an operation of your interest. 4. Write a python program to print the contents of a
directory using the os module. Search online for the function which does that. 5.
Label the program written in problem 4 with comments

You might also like