Basics of Python
Basics of Python Programming.
Python is an interpreted, interactive, and object-oriented and high-level programming language. It was created by Guido van Rossum 1985. python uses English keywords frequently and processed at runtime by the interpreter. Python is easy to learn, easy to read, and easy to maintain so let us start some basics of python programming.
Python is a widely-used programming language and there are various important applications of python include desktop applications, image processing applications, game-related apps, computational applications, scientific apps, operating systems, etc.
Python is a widely-used programming language in the field of machine learning and artificial intelligence and it is an open-source programming language that is developed using a community-based model and It can run on Windows and Linux environments so Let us take a deep dive for Basics of Python programming.
How to install python in Windows Operating System.
Download the latest version of python from the below link.
C:\>python 'python' is not recognized as an internal or external command, operable program or batch file.
Add a system environment variable for python
right-click on my computer and select an advanced system setting and just click on the environment variable button and define a new variable inside the system variable.
Now add the path of your python directory inside path variable,just mark; at the last value and define your path like;c:\PYTHON34
C:>python --version Python 3.4.3
Keywords in python programming.
Identation in python.
Indentation is spaces that are used at the beginning of any statement. The statements with the same indentation belong to the same block.
print(“we are learning python”)
Error: expecting Identation
print(” we are learning python “)
Finally, we can say that space==INDENT in python programming.
print (“I am going to execute”)
print (“I will print if TRUE is FALSE”)
print (” I am going to execute “)
print (” I will print if TRUE is FALSE “)
print (“This is the wrong indent”)
Multiline Statement in python
x=”I am one”
y=”I am two”
z=”I am three”
sum = x + \
y + \
Multiple Assignment in Python.
a = b = c = 100
a,b,c = 100,200,”movies”
Python Data Types
EXAMPLE :- How to create a python List.
data = [“one”, “two”, “three”, “four”, “five”] #python List
print(data[ : 3])
Dictionaries in Python.
Dictionaries is a data structure in python,it is different way to reprsent a record as an object that is more generally known as an associative array. dictionary consists of a collection of key-value pairs. Each key-value pair maps the key to its value.
In this example “name” is a key and “john” is value and contact is again a key and [“8800383838″,”9989767870″,”6534568345”] is a value that is a python list.
Tuples in Python.
Tuples are immutable and collection of objects which means you cannot change the values of tuple objects(values inside tuple).
DELETE A TUPE IN PYTHON
del x #use del keyword to delete any tuple.