How to start learning Python?

How to start learning Python?

Present slogan of Software Industry is – “First Learn Python Language” to start your IT career.

Python is a Beginner’s Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications like Simple Text processing, Desktop GUI, Networking, Web, Machine Learning & Artificial Intelligence, Data Science & Data Visualization and Games etc…

Note: Python can be used for Automated Testing also, Python with Selenium for Automated Functional Testing and Python with Appium for Automated Mobile Testing.

Python is a general purpose, high level, interactive, interpreted and object oriented programming language (Python While often called a programming language, Python is, technically, a scripting language.) , It is designed to be highly readable, so it is easy to learn.

Python was created by Guido van Rossum in 1991 and further developed by the Python Software Foundation. Python official website is (python.org).

Python is a simple language, its syntax allows programmers to express their concepts in fewer lines of code.

Python is a cross-platform language, It can be used on various operating systems like MS Windows, Linux, Macintosh etc,

python tutorial

Python Programming Language

So start learning Python Programming Languages, here we have to focus first on Download & Install Python, then know the Python Basic Syntax.

First Step: Download & Install Python Software

(Download your operating system compatible Python software from the Python official web site (python.org), Install Python, after installation of Python then you can get Python IDLE (Integrated Development and Learning Environment), using Python IDLE you can write & execute Python Programs.)

Note: Python is built-in in latest versions of UNIX, Linux, and in some flavors of Windows. 

Second Step: Know the Python Basic Syntax

> Python is a case-sensitive language, Python program file extension is (.py),

> All Python keywords are in lower case, Variables, Functions, Classes, Objects and Methods are the Python Identifiers.

> Python Comments starts with a #, and Python will ignore them. (Comments can be used to explain Python code)

> Python uses Indentation to indicate a block of code, (Indentation refers to the spaces at the beginning of a code line)

> Python variables are created when you assign a value to it (no separate declaration statement)

> No explicit declaration Data types in Python.

Then focus on these topics:

1) Variables and Data Types in Python

Global and Local Variables in Python, Python Numbers, Python Strings, and Python Boolean.

> Create variables by assigning values,  multiple Assignment, and deleting a variable.

> check data type of a variable in python, and Basic Data Types in Python

> Python Numbers, Strings and Boolean.

2) Python Operators

Python Arithmetic, Comparison, Assignment, Logical, Identity, and Bitwise Operators.

Python Arithmetic Operators

+ Addition (Example: 10 + 20=30)
Subtraction (Example: 10 – 20=-10)
* Multiplication (Example: 10 * 20=200)
/ Division (Example: 10/3=3.3333333333333335)
// Integer Division (Example: 10/3=3)
% Modulus (Example: 20 % 10=0)
** Exponent (Example: 10 ** 3=1000) =

Python Comparison Operators

== Equal (Example: print (10 == 5) # False)
!= Not equal (Example: print (10 != 5) # True)
> Greater than (Example: print (10 > 5) # True)
< Less than (Example: print (10 < 5) # False)
>= Greater than or equal to (Example: print (10 >= 5) # True)
<= Less than or equal to (Example: print (10 <= 5) # False)

Note: Comparison Operators return boolean (logical) Result.

Python Assignment Operators

= Equal to
+= Add And
-= Subtract And
*= Multiply And
/= Divide And
%= Modula And
**= Exponent And
//= Floor Division And

Python Logical Operators

and (Logical And)
or (Logical Or)
not (Logical Not)

3) Python Control Flow

Python Decision making, Loop, and Branching Statements.

> In Python code blocks like conditions and loops can be written using Indentation.

> Python condition / decision making blocks are if, else, elif, and nested if.

if statements
if-else statements
if-elif ladder
Nested statements

> Python loop blocks are while, for and nested loop.

> Python branching statements are break , continue , return , and goto.

4) Python User Input

Example:

str = input(“Enter Your Nsmr: “)
print(“Your Name is: ” + str)

Note: input() and print() are Python built-in functions.

5) Python Compound Data Structures

Python builtin Data structures, Lists, Sets, Tuples, and Dictionaries. 

There are four collection data structures in Python – list, tuple, dictionary and set.

List is a collection which is ordered and changeable. Allows duplicate members.

Tuple is a collection which is ordered and unchangeable. Allows duplicate members.

Set is a collection which is unordered and unindexed. No duplicate members.

Dictionary is a collection which is unordered, changeable and indexed. No duplicate members.

i. Python lists are written with square brackets.

Example:

mylist = [“Selenium”, “UFT”, “SilkTest”]
print(mylist)

ii. Python tuples are written with round brackets.

Example:

mytuple = (“Selenium”, “UFT”, “SilkTest”)
print(mytuple)

iii. Python sets are written with curly brackets.

Example:

myset = {“Selenium”, “UFT”, “SilkTest”}
print(myset)

iv. Python dictionaries are written with curly brackets, and they have keys and values.

mydictionary = {
“name”: “G C Reddy”,
“subject”: “Python”,
“year”: 2020
}
print(mydictionary)

Output is: {‘name’: ‘G C Reddy’, ‘subject’: ‘Python’, ‘year’: 2020}

6) Python Functions

Python Built-in and User defined Functions.

A function is a block of reusable code that is used to perform an action which only runs when it is called.

Create a Function: Python function is defined using the def keyword:

def my_function():
print(“Hello Python Function”)

Calling a Function:  To call a function, use the function name followed by parenthesis.

my_function()

7) Python Object Oriented Programming

Python Class, Object, Method, Constructor, Inheritance, Polymorphism, Abstraction, and Encapsulation.


After learning the above mentioned topics then you can learn other Python topics based on your job requirement:

Modules, Exception handling, File handling, Regular expressions, Database access, Multithreading, Networking, CGI, GUI Etc…

G C Reddy

G C Reddy, Working as a Software Testing Trainer in Hyderabad, India.

You may also like...

2 Responses

  1. Very nice GC Reddy Garu, I liked the way you explained everything in detail, hope you can keep posting python lectures for crash course Learners like me on each topic including few examples on each topic if possible…

    Interested for learning python in detail aswell.

Leave a Reply

Your email address will not be published. Required fields are marked *