Category Archives: Language

Python Translator – How to make ? English to Bengali or other Translator

Here I will show how to make a python tanslator. My translate language will be Bengali/Bangla and it will save to a file. Here I have made a short youtube video to show how to do it.




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 learn something about it.

Another youtube playlist I found easy to understand really:

Normal procedural code look like:

Code examples from this video of OOP for future reference:





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__’:

why it is used in code, here i found a logical explanation.

the code i applied from that link to here.

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.


for python library we can use bulit in library or third party library that is available on for example: email, pdf etc.

File handling in Python:

Reading- reading when file exist code= ‘r
Writing – writing write content in the file code= ‘w’
it will be create a file
Appending -add contents to the file and no overwrite code = ‘a’

Some python code and screenshot with pycharm_
fileobject=0pen(“name of the file”,”mode of the file”)
method name can be read write append etc.


this two youtube video helped me to learn in details than udemy video:


Why we use seek in opening file and how to use it ?
Because the open is only usable once but after that to open the same thing several times we need seek()


another one to read all three lines at once:


Another example of writing, one thing is r+ means read and write both.

Path are two types in a python system:

Absolute path and Relative path:

File Input output error:

Debugging in Python:

Output in run:

PIP Install in Pycharm on Windows environment:
pip install package-name
In below terminal not in python console


Python Job Tricks:
– Show you have real experience by building projects

Regular Expressions:
Regular expressions are langauge independent. It is also available in other languages. It needful to check validation of words.

out put:

it means that ‘this’ start at span 17 and ended in span 21

Nobody remembers regex we learn it when needful. We learn later by email and password checker making.

No one ask you in interview about Regex. Sso you just know how to do it.

This interactive tutorial has been suggested by Androe:

Now adding with another code for email validation:

Password validation:


Testing is not only in python but also for all others platform

We are learning unittesting in this section: