Skip to main content

Command Palette

Search for a command to run...

👀Learning Modules, Comments and pip ---

Published
•2 min read•View as Markdown
👀Learning Modules, Comments and pip ---
A
Python | C | DSA | AWS | PowerBi

HEY EVERYONE !!

Welcome back , Today we are going to learn about some basic concept and we will alo write our first python code in todays learning blog.

Lets write our very first python program ,Create a new folder in your pc name it what you want then right click on mouse and you see “open with Vscode“ option click on it and your vs code is now open.

Create a file called hello.py and paste the below code in it.

Print ("Hello World")
#print is a function here.(more information later)

Execute this file (.py file ) by typing python hello.py in terminal 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.

Types of modules

There are two types of modules in Python:

  1. Built-in modules – Pre-installed in Python

  2. External modules – Need to install using pip

Some examples of built-in modules are os, abc, etc.

Some examples of external modules are TensorFlow, flask, etc.

Pip

Pip is a package manager for python. You can use pip to install a module on your system. E.g., pip install flask (It will install flask module in your system)

pip install pandas 
pip install flask

Using Python as a Calculator

We can use python as a calculator by typing “python” + TO DO on the terminal. [It opens REPL or read evaluation print loop]

3+2
63736363*65656

Comments

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

Types of Comments:

There are two types of comments in python,

  1. Single line comments – Written using # (pound/hash symbol)

  2. Multi-line comments – Written using ‘’’ Comment ‘’’ or “”” Comment “””.

#this is my first code about sum of numbers.
print ("3+4")

This is the end of chapter 1 i’ll be back tomorrow !! STAY WITH ME …..