Python is an interpreted high-level programming language for general-purpose programming which can be used for any purpose.For example, you can use python language for coding anything from a simple game to a dynamic website.
For machine leaning,data science,web development,shell scripting, server side in every sector you can use python.
Youtube,dropbox and many more high profile sites are using python .
Hence, for any programming lover python should be good choice.

There are two version of python,python 2,python 3.
Python 3 is most upgraded with different changes so it is highly recommended to use python 3.

Now, lets drive some basics of python programming language.
We will first use a online editor to understand the basics.
Follow this link  Online Editor . 

Hello world

# This line of code will print “Hello, World!” to your terminal
print(“Hello, World!”)

Variables
You can declare any variable without explicitly telling it’s data type.
python will automatically understand the data type.

# declare variables
message = “Good morning”
num = 85
pi = 3.14159

print(type(message)) # This will return a string
print(type(n)) # This will return an integer
print(type(pi)) # This will return a float

 

a = 5
print(a, “is of type”, type(a))

a = 2.0
print(a, “is of type”, type(a))

a = 1+2j
print(a, “is complex number?”, isinstance(1+2j,complex))

If Else
Like any other programming language we can use conditional logic in python by following way.

a = 33
b = 33
if b > a:
print(“b is greater than a”)
elif a == b:
print(“a and b are equal”)

 

# read in age
age = int(input("What's your age?"))

if age >= 18:
    print("Access allowed")
elif age < 18 and age > 0:
    print("Access not allowed")
else:
    print("Invalid age")

Loop in python

primes = [2, 3, 5, 7]
for prime in primes:
print(prime)

# Prints out 0,1,2,3,4
count = 0
while count < 5:
print(count)
count += 1 # This is the same as count = count + 1

Collections
Python has some collection data types like List,Tuple,Set and Dictionary.

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.

List
A list is a collection which is ordered and changeable. In Python lists are written with square brackets.

# create a list called my_list
my_list = [1, 2, 3, “python”, 67, [4, 5]]

# go through my_list and print every item
for item in my_list:
print item

# create a list called my_list
my_list = [1, 2, 3, “python”, 67, [4, 5]]
print(my_list[3])

Set
A set is a collection which is unordered and unindexed. In Python sets are written with curly brackets.

thisset = {“apple”, “banana”, “cherry”}
print(thisset)

Tuple
Tuple is an ordered sequence of items same as list.The only difference is that tuples are immutable. Tuples once created cannot be modified.

thistuple = (“apple”, “banana”, “cherry”)
print(thistuple)

Dictionary
dictionary is an unordered collection of key-value pairs.

It is generally used when we have a huge amount of data. Dictionaries are optimized for retrieving data. We must know the key to retrieve the value.

In Python, dictionaries are defined within braces {} with each item being a pair in the form key:value. Key and value can be of any type.

# create a dictionary
person = {
“name”: “Amos”,
“age”: 23,
“hobbies”: [“Travelling”, “Swimming”, “Coding”, “Music”]
}

# iterate through the dict and print the keys
for key in person:
print(key)

# iterate through the dict’s keys and print their values
for key in person:
print(person[key])

 

  PART 2