Category Archives: Python

Python Course Zero to Mastery Started at Udemy

Python usually uses an interpreter. The compiler are a little bit different.

Interpret translates line by line.

Compiler takes all lines to machine code.

What is programming language? We give some instruction to translator. They tell the machine what to do. Translator can be interpreter or compiler.



Python basics till numbers:

Double Slash in Python:

/ -> float division
//-> integer division

don’t memorize which available on the documentation

String type conversation.

Formatted String:

String Index



Built in functions

Software to find your current age with python:

#1 “old style” string formatting(% operator)


Template string ta pore kokhono hoyto dekhbo, ei ar ki

password length printing code from the course:



list operations:

we can see the function from online documentation from the official site or other sites








set is an unordered collection of unique objects.



Truthy and Falsy:


Exercise: Logical Operators


is vs == 
with using ‘is’ it needs to be refers to the same object

with == it needs to be equally same valued

for example:



Exercise: Counter will print item in list





break, pass, continue



Parameters and Arguments:

Return in python:

How it works:

without return it prints none:


with return it prints something that I insisted for:

Nested Return:

#issues with print and return



Exercise: To find even and max value from a list


Abstraction: private vs Public





no amount of video is enough you have to learn by your way of development projects.

4 pillars in oop Encapsulation, Abstraction, Inherítance, Polymorphism


Now i am looking for another video from youtube to earn something about it.

Now the exercise from the udemy course:

Super,Object Introspection, Dunder/Magic method

1st example:


2nd example:


#Multiple Inheritance

#Method Resolution Order(MRO)

Pure Function





output: [(1, 10, 5), (2, 20, 4), (3, 30, 3)]

reduce() function and how it works in python:

I have seen two videos here from udemy and youtube to clear this concept for me

code from udemy:



Exercise solutions here in function:

#1 Capitalize all of the pet names and print the list


#2 Zip the 2 lists into a list of tuples, but sort the numbers from lowest to highest.

#3 Filter the scores that pass over 50%

#4 Combine all of the numbers that are in a list on this file using reduce (my_numbers and scores). What is the total?


Lambda Expressions in python:

Lambda is a computer science term. Which is an anonymous function. Which don’t use more than once for a purpose. Usually in lambda we don’t need to decalre any function name. What happens inside a function we can write in simple line using lambda function.

lambda using map:

lambda using filter:

lambda using reduce:

# Exercises using lambda
1. make a lambda example to squre

2. make a lambda example to make a sorted list

List Comprehension

Set and Dict Comprehension:

#dict comprehension

Comprehension is for shorthand.

Now a small exercise:

Problem: to write a one line code to find duplicate character to show in a answer
Soln code:



another example:

Higher Order Function HOC

the decorator can supercharge the function and can add an extra feature


Another example:

Practical Application of Decorator:


Need to do later as it is not downloading on my tablet

Error Handling:


custom error in error handling:

Range is a generator. Generator is special type in python

generator is iterable but all iterable is not generator
example: range is generator that is always iterable, list is also iterable but not generator


Some examples of using modules here: : in this file I put all the functions for opertions

Now I am sending values to those function using main :


Again another way:

The thing need to remember usually in a package automatically a file creates.

Another important thing a successful program without error run with exit code 0
And with error run with exit code 1

Another way of example:


Again example with names:


#if __name__==’__main__’:

Python Built in Modules:

In other language it is known as standard library.
You don’t need to remember all, just know it exists and google it when needful.






Programming Problem Solve with Python:

Problem: Only Positive Numbers



Pyhton as a new beginning

Same output but the code is in diffrent approach.



Loop Over Integer Colors


Python Course Started, Alhamdulillah

The Python Mega Course: Build 10 Real World Applications

Bismillahir Rahmanir Rahim. I am exploring this course for growing interest in my career:

Summary: Integers, Floats, Lists, Dictionaries, Tuples, dir, help

In this section you learned that:

  • Integers are for representing whole numbers:
  1. rank = 10
  2. eggs = 12
  3. people = 3
  • Floats represent continuous values:
  1. temperature = 10.2
  2. rainfall = 5.98
  3. elevation = 1031.88
  • Strings represent any text:
  1. message = “Welcome to our online shop!”
  2. name = “John”
  3. serial = “R001991981SW”
  • Lists represent arrays of values that may change during the course of the program:
  1. members = [“Sim Soony”, “Marry Roundknee”, “Jack Corridor”]
  2. pixel_values = [252, 251, 251, 253, 250, 248, 247]
  • Dictionaries represent pairs of keys and values:
  1. phone_numbers = {“John Smith”: “+37682929928”, “Marry Simpons”: “+423998200919”}
  2. volcano_elevations = {“Glacier Peak”: 3213.9, “Rainer”: 4392.1}
  • Keys of a dictionary can be extracted with:
  1. phone_numbers.keys()
  • Values of a dictionary can be extracted with:
  1. phone_numbers.values()
  • Tuples represent arrays of values that are not to be changed during the course of the program:
  1. vowels = (‘a’, ‘e’, ‘i’, ‘o’, ‘u’)
  2. one_digits = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
  • To find out what attributes a type has:
  1. dir(str)
  2. dir(list)
  3. dir(dict)
  • To find out what Python builtin functions there are:
  1. dir(__builtins__)
  • Documentation for a Python command can be found with:
  1. help(str)
  2. help(str.replace)
  3. help(dict.values)

Mission Machine Learning

Pagerank Algorithm Eigenvalue


Square Matrices



Geometric Interpretation




For Loops in Python






Python String formatting

Playing With String in Function of Python

With First letter capital:

Converting string to int:

For Python 1 and 2



Python String Input Need To Clear From Internet


Python Function Calling







  • Check if a value is of a certain type with:
  1. isinstance(“abc”, str)
  2. isinstance([1, 2, 3], list)


  1. type(“abc”) == str
  2. type([1, 2, 3]) == lst

Python Function


Positive/Negative Indexes, Slicing of Tuples


Working with lists and append

Question:Append the first item of weekend to workdays



Dictionary in Python

Assign a dictionary variable day_temperatures.The dictionary should contain three keys ‘morning’,’noon’and evening and each key should containa tuple as value. each tuple should contain three floats.



Difference between tuple and list in python