Python 01: Python Basics

History, Installation and Command Line Interface.

ยท

2 min read

Python 01: Python Basics

Python Basics

  • Python is interpreted language, and statements are executed line by line.

  • source code is stored in .py file extension.

History

Python 1Python 2Python 3
20 Feb 199116 Oct 200003 Dec 2008

From python, we can make -

  • Games -

    • Flappy bird using PyGame

    • Snake game using PyGame

  • Websites- in the backend using Python flask

  • GUI (Graphics User Interface)

  • Natural Language Processing (speaking to/with the machine)

Python used By :

  • Instagram Backend

  • Facebook Backend

  • Youtube Custom

  • Intel

  • IBM

  • NASA

  • JPMorgan

Developed By:

  • Guido Van Rossum

Name Script Taken From:

  • "Monty Python's Flying Circus" from a BBC comedy series.

How to run a python file in CMD of the current directory :

python filename.py

How to install External Module:

  • Open PowerShell

  • Write pip install module_name

  • Run python REPL(Run Evaluate Print Loop) by writing Python

Run Python in PowerShell:

python
import flask

(Shows "No Error")

import random

"No Error" - (It is Built-in Module)

import pandas

Shows "Error" - (It is Not Found) We have to download from the internet.

exit()

Important Remarks:

  • pip - Package Manager of python

  • You can also use another software like - V.S.Code, Sublime Text, Atom.

  • Don't use the module name as "Python file" Names like a flask, pandas e.t.c

  • You can use multiple interpreters like python 3.9, 3.8, 3.7 e.t. simultaneously in Pycharm

  • Module:

    • Built-in Module - already in python

    • External Module - download from the internet

Project Example:

  • Print Receipt for every client of a company which has to give only name, phone no. and address then it prints their receipt. (only required to fill detail then it converts into receipt) -> (Payment Calculator)

Using Python REPL as a calculator

Run Python in PowerShell:

20+56+25

Out[1]: 101

56*10

Out[2]: 560

10*4 + 5*9 + 36*8

Out[3]: 373

36/8     # Float Value

Out[5]: 4.5

25/5    # Float Value

Out[6]: 5.0

25//5    # Int Value

Out[7]: 5

Did you find this article valuable?

Support Mohd Irfan by becoming a sponsor. Any amount is appreciated!

ย