top of page
Search

Python 101 - Data & AI

Welcome. Follow along for a no-nonsense course. Designed and aimed to be direct, to the point, learn-by-doing style.


  1. Install an IDE + Python

I use a machine with Linux distribution (Ubuntu 22.04.5 TLS as of 8-Jan-2025). So, my examples are aligned to match that setup. It doesn't matter what OS you have but get an IDE. There are quite a lot of them:

Pick one and install it. From experience I know, the combination of OS + Hardware + user preference, it is nearly impossible to make 'one' suggestion that works for everyone. So, you decide but get one IDE installed for/with Python.


  1. No-installation - Python Practice

The keyword here is 'practice'. Even if you have an average internet connectivity and a machine you can't make installations, then this is for you. Search for 'Python IDE online'. There are many 'free' for beginner-level-usage online compilers. Pick one and you should be good to go.


Two things to remember with this option:

  • There are 'no free lunches' in the online world (so be prepared for ads or sign-up requests, everyone needs something from you - to start with, it is your email ID 😊).

  • Even though they are 'technically' free. Do not overload these wonderful sites. Millions of students use these and it robs off the people with the means to learn.


  1. Python Introduction

Python is a programming language. We can get into details later. I will just leave some links here:


  1. Readiness Check

Choose where you will save your programs. For me, it is my local machine:

If you are using the #2 then before you jump into learning, ensure you can save the Python programs that you test to a retrievable location (be it your local machine or online storage).


I'm using PyCharm Community Edition. I would like to point out 3 things here:

#1: Storage Location

#2: Virtual Environment

#3: Python Version


Again, we will come back to these in detail in later sections. If you are using a different IDE then too the concepts are all the same but might differ on the UI. These 3 are important when we get to the stage of industrializing your code.


  1. Hello World

One of the superpowers of Python is its simplicity. Take a look:


The code above is:

print('Hello World')


Now, let us get real. Let us start with some basic tasks and this whole series of Python learning will be 'task' based.


Task: Get the Current Date


Code:

import datetime

current_date = datetime.date.today()

print(current_date)


Traditional Explanation (or to say Gemini GPT explanation:


  • The first line of code imports the datetime library. This library provides classes and functions for handling dates and times.

  • The second line of code uses the datetime.date.today() method to get the current date. The today() method returns a datetime.date object representing the current date.

  • The third line of code uses the print function to display the value of the current_date variable on the console. The current_date variable now holds the current date as a datetime.date object.


The key takeaways here are:

  1. Module --> datetime

  2. Class --> date

  3. Function --> today()


We will revisit the structure of a module and its internal workings later in the course. But, as a learner, you should focus on understanding "how to use them" first.


Let us use the same Task objective "Get the current date" but we can explore different ways together in the next post. Don't wait for the next post till then -- keep learning.

 
 
 

Comentários


I Sometimes Send Newsletters

Thanks for submitting!

bottom of page