Python Tutorial Part-1

What is Python

Python is a popular programming language which was created by Guido van Rossum. It was released in 1991.

It is used for:

  • Web Development
  • Mathematics
  • System Scripting
  • Software Development
  • Video Games
  • Artificial Intelligence
  • Machine Learning
  • Deep Learning
  • Data Science
  • Mobile Application Development, etc.

Python can do:

  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used on a server to create web applications.
  • Python can connect to database systems. It can also read and modify files.

Python works on different platforms like Windows, Mac, Linux, etc. Python has simple syntax similar to the English language. Python can be treated in a procedural way, an object-oriented way or a functional way. Python can implement scripts in fewer lines as compared to other programming languages like C, C++, Java, etc. Python also supports the Object Oriented Programming concept (oops). 

Let’s start code:

Print() Method

print(): print method is used to print the sentence or word on console or screen.


print("Hello, World!")

How to check the version of python.

Check version: To check the python version in windows.


C:\Users\Name> python --version

How to run a Python program.

Run python program: Write a code or program in IDE (Integrated Development Environment) and then save the file with “.py” extension. Example: ( Then open the command prompt on the same location, then write a command (python to run the program.

Save code:

Run code: python

Python Command Line

Sometimes to test a short amount of code in python. So, there is a quick and easy way to test Command Line. We can test a code in the command line or command prompt.

  • Open command prompt.
  • Write “python” or “py” into the command line.
  • Then write code to test.
  • For example: 5+10, print(“Hello World”), etc.
  • To exit from the command line, write “exit()”.

Python Indentation

Python Indentation refers to the space at the beginning of the code line. In other programming languages, the indentation is only for readability. But Indentation in python is very important. Indentation can generate the compile time error. You have to be careful.


# This code will compile successfully. All spaces and indentation are perfect.
If a > b:
     print(“a is greater than b”)
     print(“b is greater than a”)

# This code will give an indentation error
If a > b:
print(“a is greater than b”)
print(“b is greater than a”)

Python Variables:

Variables are created when you assign a value in it. For example: if you assign a floating point value in a variable then it will be a float variable, if you assign a string in variable then it will be a string variable.


  • Variable names are case sensitive (Age, age and AGE are different variables). 
  • Variable names must start with character or underscore(_).
  • Variable names can’t start with a number.
  • Variable names can only contain alphanumeric characters (A-Z, a-z and _). It not contain special characters (@, -, %, /, *, $).


S = “Hello World”      # String type variable
X = 20                       # Integer type variable
Y = 3.5		 # float type variable
C = ‘A’			 # character type variable

Python allows you to assign multiple values in a single line.


→ X, Y, Z = “ Lion, Leopard, Tiger ”
print(X)	# Lion
print(Y)	# Leopard
print(Z)	# Tiger

→ X, Y, Z = 4,7,9

→ X = Y = Z = “ Programming ”
print(X)	# Programming
print(Y)	# Programming
print(Z)	# Programming

Output Variable:

We use the print() method to display the variable on the console.

Syntax and Examples are:

→ X= 3
print(“The latest version of Python is ”+X)

We use the + operator to add two or more strings.

→ S1 = “Python”
S2 = “Programming”
S3 = S1 + S2
print( S3 )

→ X = 5
Y = 7
print( X + Y )

Local and Global Variables:

→ Local variables: Variables which are created inside the function are known as Local Variables.

Note: We will learn about function in the next tutorial. Just try to understand the concept of local and global variables.

Example 1:

def  abc():
	A = 5		# Local variable

abc()	# function call

→ Global Variables: Variables which are created outside the function are known as Global Variables. Global variables are accessed from both sides inside the function and outside the function.

Example 2:

A = 5		# Global variable
def  abc():

abc()	# function call

Basically variables which are created inside the function are local variables. But we can make them global variables with the help of the global keyword. Just write global before the variable name. 

Example 3:

def  abc():
	A = 5		# Local variable
	global B = 8	# Global variable

abc()	# function call
print(B) # print variable B outside the function. It will compile because B is a global variable

Video Tutorial 

Thank You !!!!!!!!


If you have any doubts, Please let me know

  1. I appreciate you taking the time and effort to share your knowledge. This material proved to be really efficient and beneficial to me. Thank you very much for providing this information. Continue to write your blog.

    Data Engineering Services 

    Machine Learning Services

    Data Analytics Services

    Data Modernization Services

  2. Nice post with informative and good quality content. Thank you for sharing this information with us. This is really helpful. Also check Data Science Engineering College in India .

Post a Comment
Previous Post Next Post