Introduction to Python

Introduction

Rabindra Sapkota - Python Instructor
Rabindra Sapkota - Lead Data Engineer, Python Instructor

What is Python?

  • High-level, Interpreted programming language
  • Created by Guido van Rossum in 1991
  • Open Source
  • Has a lot of libraries and community support
  • Supports Structural & OOP Programming
  • Code are case sensitive
  • Uses
    1. Data Science, AI and ML
    2. Web Development
    3. Scripting & Q/A automation
    4. IOT and Robotics etc.

Sample Code

  • Python file is saved with .py or .ipynb extension
  • print("Hello, World!")
  • print(2)
  • print(4 + 5 * 2)
  • x = 5 y = x + 10 print(y)
  • age = 16 if age >= 18: print("Eligible to vote") else: print("Not eligible to vote")

IDE

  • Integrated Development Environment
  • Software application used for
    1. Writing, Editing and Running code
    2. Identifying errors (Debugging)
    3. Syntax highlighting
    4. Version control integration
    Some Popular Python IDEs:
    1. Visual Studio Code (VS Code)
    2. PyCharm
    3. Jupyter Notebook
    4. Google Colab
    5. Spyder

Installation and Setup

  • Download and install Python (Note: Check on Add to path during installation)
  • Download and install VS-Code
  • Install Python Extension in VS-Code
    1. Go to Extension view (shortcut: ctrl+shift+x)
    2. Search and install Python extension from Microsoft
    For running Python code
    1. Create a new file with .py extension
    2. Copy codes from previous slide
    3. Click play button on top right to run
    4. See if code works as expected

Google Colab

  • Free cloud-based Jupyter notebook environment
  • No setup required, runs in browser
  • Great for data analysis, machine learning, and sharing code
  • Code will be saved in Google Drive automatically
  • Coding in Colab:
    1. Open Google Colab in browser
    2. Click + New Notebook on bottom left to create new file with meaningful name
    3. Add code cells using + Code button from top bar
    4. Write Python code in cells
    5. Click play or type Shift + Enter to run a cell and move to next