top of page

Python Programming Assignment help-Python Complete course from start to end | Learn python from A-Z

In this blog, first of all we will learn - what is python? and Why we will learn python?





What is python?


Python is an object-oriented, high-level programming language with integrated dynamic semantics primarily for web and app development. It is extremely attractive in the field of Rapid Application Development because it offers dynamic typing and dynamic binding options.


Why we will learn python?


There are many reason to learn python, which is given below:

Simple to use: Python is simple to use than the other programming language. In this no need some extra features like semicolon which used in all other programming language.


Collection of pre-exist library: Python is a collection of pre-existing library which make it better and easy to use than the other programming language.


Coding in multiway: We can use coding in Python in multiple ways: data science, web development, and machine learning.


Python Basic -Let's ready to learn


How print "helloworld"?

First we will learn how print statement work in python. Here we will understand it with the help of example:

Ex.


print "helloworld"

or

print("helloworld")


Python Variables

In python, we can easily define the variables like:


a=1


it means variable "a" store the integer value 1.


Other way to declare variable in python:


a="naveen kumar"


a=19.8


a=True

a=False


Conditional Statements


In python we will learn different python of conditional statement like other language(C,C++, etc.)

In python three types of conditional statements are used:


"If" Statement

It returns two value true and false, whether statement is true of false:


For Example:


if True:

print("its a true statement")


or


if 1>0

print("its a true statement")



"If-else" statement

It return two value True and False if condition is true and false


For Example:


if 0>1:

print("zero is greater than one")

else:

print("one is greater than zero")


"if-elif-else" statement


For Example:

if 0>1:

print("zero is greater than one")

elif:

print("zero is not greater than one")

else:

print("zero is equal to one")


Loop in python:


In this we will learn two types of loop for and while:


for loop:


Ex.

for i in range(0,10):

print(i)


it print the value form o to 9 it not considered last value 10.


or


Simple iteration by loop:

Ex.


i=[1,2,3,4]

for j in i:

print(j)



With three argument:

Ex.

for i in range(3,8,2):

print(i)


out put:(first argument for start and second for length and third for increment )

3,5,7(not more than 8)


while loop:

The while loop needs a “loop condition, if true it return value when false it stop to return value.


Ex.

i=5

while (i>8)

print(i)

i+=1


List: Collection | Array


List is a collection that can be used to store a list of values like integer, string, etc.

Ex.

list=[1,2,3,4,5]

it is the collection of integer value at index 0,1,2,3,4 like array.

list[0]=1


if we want to print list element than use this types of print statement:

print(list[0])

output: 1

it print 0th index value.


You just want to store strings:

Ex.

name=[

"naveen",

"kumar",

"rajput"

]

it work same as integer.


Add string in the list:

use "append" to add element in the list


Ex.

name.append("is a software developer")


Dictionary - key value


Dictionary is a collection of key-value.

Ex.

phone=[

"nokia":1100

"Samsung": "Galaxy J7"]

print("my phone is %s" %(phone["Samsung"]))


Add record to the dictionary phone:


phone=[

"nokia":1100

"Samsung": "Galaxy J7"]

phone['RealMe']="note book 7" # add RealMe to list phone


For more details learn python official website doc file.


Classes & Objects


Objects are a representation of real world objects like cars, dogs, etc

Class is the blueprint from which individual objects are created. In the real world, we often find many objects with the same type. Like cars


How declare python class:


Ex.

class cars:

pass


Here pass is used to pass class if there is no class variable assign it used to remove error message until class value assign.


Create an object like this:


Ex.

z=cars()

print(z)


Here z is an object of class cars.


Create constructor method


To create an constructor in python we will use init method


Ex.


def __init__(self,argument1,argument2,....argumentn):

pass


it call again and again when objects are created


We will understand it easily by this example:


Ex.

class Person:

def __init__(self, first_name, email):

self.first_name = first_name

self._email = email

def update_email(self, new_email):

self._email = new_email


def email(self):

return self._email

a=Person('naveen','naveenkumarraj4@gmail.com')

print(a.email())


Types of method


Public method:

We can use it out of our class like above given example.


Private method:

We can'T use it out of our class like above given example. It use by "_" at the front of method.


Ex.


def _email(self):

return self._email


If you like Codersarts blog and looking for Assignment help,Project help, Programming tutors help and suggestion  you can send mail at contact@codersarts.com.



Please write your suggestion in comment section below if you find anything incorrect in this blog post.


bottom of page