We Should Know About Types Of Machine Learning

We Should Know About Types Of Machine Learning


types of machine learning

In This Article we will discuss more about Types Of Machine Learning.

Types Of Machine Learning :



As we know there is three types of Machine Learning.

  1. Supervised
  2. Unsupervised
  3. Reinforcement

(1) Supervised :

- In Supervised Learning machine learns under guidance as a teacher guides the student.

- Machines learns from provided data to them and explicitly telling them this is the input and this is how the output must look.

- Here, the system is trained using past data(which includes input and output), and is able to take decisions or make predictions, when new data is encountered.

- In example of teacher and student teacher is training data and student is machine.



(2) Unsupervised :

- The system is able to recognize patterns, similarities and anomalies, taking into consideration only the input data.

- Unsupervised means without any supervision or without anybody's direction.

- Here the data is not labeled and there is no guide.

Recommended Articles :

- Machine has to figured out data set given and find out hidden patterns.

- In short machine has to make predictions.

- We can say Unsupervised learning is our daily activities on which we take decision own self.


(3) Reinforcement :

- Decisions are made by the system on the basis of the reward/ punishment it received for the last action it performed

- Reinforcement Learning means Machine takes decision once and gives output.if it's right then OK.

- Otherwise it gives feedback after that it data Re-train again.

- This process occurs till the output not comes right.

- so, basically this type learn from feedback and past experiences.


In short terms :


1) Supervised :  
  • Labeled Data
  • Direct Feedback
  • Predict Outcome / Future


2) Unsupervised :


  • No Labels
  • No Feedback
  • Find Hidden Structure In Data





3) Reinforcement :

  • Decision Process
  • Reward System
  • Learn Series Of Actions


There are 4 main parts of machine learning.


  • Machine Learning
  1. Supervised :
  • Classification
  • Regression
  1. Unsupervised :
  • Clustering
  • Association

Supervised  


1) Classification 


The data needs to be divided into a number of different categories based on training using past data.

An example of a classification problem, would be how we are able to sort emails are spam or otherwise using previously received emails that have been already identified. 

A famous algorithm that can be used to solve classification problems, is the Naive Bayes theorem New Mail Classification Not Not spam Senator on spam Regression Learns Spam Spam Enables the machine to be trained to classify observations into some class

2) Regression 


 We predict a value for an input based on previously received information. 

Although this sounds similar to classification considering that they both use past data to make predictions, their similarity ends there of regression, 

you're trying to In the case estimate a value and not just a class of an observation Now let's consider weather prediction.

The likelihood of it raining today can be calculated by taking weather factors like temperature, humidity a measurement of other pressure, wind-speed, wind-direction and then seeing how they correlate to rains in the past. 

If the measurements taken today are strongly correlated to days when it rained then the likelihood of it raining is high today The linear regression algorithm is one that's commonly used to solve this problem.

You May Also Like This Article :


Unsupervised 


1) Clustering


This uses a method where we assign a set of observations into subsets. These subsets are known as clusters. 

The observations inside these clusters are similar to one another, based on some parameter or other Hence, all the data is divided into clusters.

An example of when clustering is used, when a telecom provider wants to set up a network in a region by setting up towers there,

They use the clustering algorithm, taking into consideration areas that would provide optimum connectivity to all users and the maximum range a cell tower would have, to divide the entire region into clusters. 

K Means is a prominently used method to cluster data in k-clusters based on some similarity measures. 

2) Association


In an association problem, we identify patterns of associations between different variables or items. 

Its concepts are applied to e-commerce websites, where they're able to suggest other items for you to buy.

It is based on the prior purchases that you've done Previous shopping history Suggests Clustering Association Learns Flip-kart, amazon Identifies patterns of association between different variables and items

I hope this article is help to you for learn types of machine learning.

You can also learn :

Things You Should Know About Python Before Learning Python :


Python is an interpreted, high-level, general-purpose programming language. Developed by Guido van Rossum and first released in 1991,

The Reasons  For Why Writing Software Applications in Python


1) Readable and Maintainable Code
2) Multiple Programming Paradigms
3) Compatible with Major Platforms and Systems
4) Robust Standard Library
5) Many Open Source Frameworks and Tools
6) Simplify Complex Software Development
7) Adopt Test Driven Development

The Python Applications :


1) Web and Internet Development
2) Applications of Python Programming in Desktop GUI
3)  Science and Numeric Applications
4) Software Development Application
5) Python Applications in Education
6) Python Applications in Business
7) Database Access
8) Network Programming
9) Games and 3D Graphics
10) Console-based Applications
11) Audio – or Video- based Applications
12) Applications for Images
13) Enterprise Applications
14) 3D CAD Applications
15) Computer Vision
16) Machine Learning
17) Robotics
18) Web Scraping
19) Scripting
20) Artificial Intelligence
21) Data Analysis


You Also Can Search For Other Python Keywords Like :

Python , Python For Loop  , Python Loops  , Python Tutor  , Python Tutorial  , Python Dictionary  , Python Learning  , For Python List  , Python List  , Python Anaconda  , Python Download  , Python Range  , Python Regex  , Python Else If  , Python If Else  , Python Programming  , Python Snake  , Python Class  , Python Set  , Python In Function  , Python Function  , Python 3  , Python Pandas  , Python Random  , Python Array  , Python Requests  , Python Tuple  , Python Enumerate  , Python Write To File  , Python IDE  , Python Logger 

 Python String  , Python While Loop  , Python Map  , Python Install  , Python Read File  , Python Code  , Python Flask  , Python Json  , Python Operator  , Python Or Operator  , Python Zip  , Python Compiler Online  , Python Online Compiler  , Python Online  , Python Replace  , Python Join  , Python Unit Testing  , Python Unittest  , Python Machine Learning  , Python With Machine Learning  , Python Certification  , Why Python For Machine Learning  , Python Interview Questions  , Python gui  , Python Reverse String  , Python Compiler 

The Python Regular Expression  , Python Queue  , Python 2.7  , Python Yield  , Python Web Scraping  , Python IDE Online  , Python Django  , Python Scripting  , Python Numpy  , Python Multithreading  , For Python  , Python Or  , Python Generator  , Python For Windows  , Python 3.7  , With Python  , Python Documentation  , Python Version  , Python Beginners  , Python For Beginners  , Python Language  , Python List Functions  , Python Projects  , Python Data Structures  , Python Mysql  , Python Library  , Python And  , Python w3schools  , Python Modules  , Python Hello World  , Python Data Types  , Python 3.6  , Python Interpreter  

Python Keyerror  , Python Ord  , Python Meaning  , Python Ordereddict  , Python Xrange  , Pythonanywhere  , Python Range Function  , Python For Data Analysis  , Python With Data sScience  , Python For Data Science  , Python Basics  , Python Interpreter Online  , Python Online interpreter  , Python Cheat Sheet  , Python Cheat Sheet  , Python vs Java  , Python Syntax  , Python Xml Parser  , Python Xml Parsing  , Python Join List  , Python Editor

Python Lambda Functions !!

Python Lambda Functions !!



In this article we will discuss Lambda functions in python.

Lambda Functions 


Python is used to declare function in standard manner.

For Example : def keyword

Lambda is used when you need a function that : 

● is anonymous (does not need a name) and 
● contains only an expression and no statements.

Syntax :

lambda argument : expression

Program :


Output : 9

Lambda can take multiple arguments and can return multiple values together.

Syntax :

lambda argument 1, argument 2,.... : expression

Program :


Output :


The lambda function can be used as an argument to the higher order functions as arguments.

Program :


Output :

answer is : 21

Lambda function is also used as a event handler.

In this article we discuss about lambda functions in python briefly, for more articles keep join us!!

Things You Should Know About Python Before Learning Python :


Python is an interpreted, high-level, general-purpose programming language. Developed by Guido van Rossum and first released in 1991,

Basic Programs Of All Python Methods


1) Program :


Python program to print Hello World.

# This prints Hello World on the output screen
print('NibKarma')

Output :


Hello NibKarma

List Programs

2) Program :



def string_length(str):
    count = 0
    for char in str:
        count += 1
    return count
print(string_length('NibKarma'))


Output : 8

Python Dictionary

3) Program :


def char_frequency(str):
    dict = {}
    for n in str:
        keys = dict.keys()
        if n in keys:
            dict[n] += 1
        else:
            dict[n] = 1
    return dict
print(char_frequency('NibKarma'))

Output :


{'a': 2, 'N': 1, 'i': 1, 'K': 1, 'r': 1, 'm': 1}

Python Tuple 

4) Program :

tuple=('a','b','c','d','e')
print(tuple)
del tuple[1]
print(tuple)

Output :


('a', 'b', 'c', 'd', 'e')

5) Program :



a = "Hello world"
print(a)
print(a[0])
print(a[1])
print(a[2])

x = "Hello"
y = "Khush"
print(x+y)

s = "Hello Khush"
print(s[0:2])
print(s[2:7])
print(s[4:])

Output :


Hello world
H
e
l
HelloKhush
He
llo K
o Khush

Python Pass

6) Program :


l=[1,2,3,4,5]
for i in l:
    if i==3:
        pass
        print ("Pass execute")
        print("Hello khush")
    print(i)

Output :


1
2
Pass execute
Hello khush
3
4
5

Python List

7) Program :



a1=["khush","jinu","ashu","shwetu"]
print(a1)
a3=['a','b','c']
print(a3)
a5=[1,2,3]
print(a5)
a6=[1,'khush']
print(a6)


a=['a','b','c','d','e']
print(a)
a[2]=3
print(a)
a[1:3]=1,2
print(a)
a[0:]=1,2,3,4,5
print(a)
del a[1]
print(a)

n=["khush","nishu","priti"]
print(n)
n.append("jinu")
print(n)
n.insert(2,"siya")
print(n)

n=["khush","nishu","priti"]
print(n)
n.remove("nishu")
print(n)
n.remove(n[0])
print(n)

n=[1,2,3,4,5]
print(n)
print("length is "+str(len(n)))

n=[1,2,3,4,5]
for i in n:
    print(i)

a=["khush","keri","ketan","khushi"]
print(a)
print("after sorting :")
a.sort()
print(a)

a=["khush","keri","ketan","khushi"]
print(a)
print("after reverse :")
a.reverse()
print(a)

a=["khush","keri","ketan","khushi"]
print(a)
n=max(a)
print(n)
n=min(a)
print(n)

print("maximum and minimum in numbers")

a=[1,2,3,4,5]
print(a)
n=max(a)
print(n)
n=min(a)
print(n)

a=[1,2,3,4,5]
print(a)
n=max(a)
print(n)
n=min(a)
print(n)
a.clear()
print(a)


Output :


['khush', 'jinu', 'ashu', 'shwetu']
['a', 'b', 'c']
[1, 2, 3]
[1, 'khush']
['a', 'b', 'c', 'd', 'e']
['a', 'b', 3, 'd', 'e']
['a', 1, 2, 'd', 'e']
[1, 2, 3, 4, 5]
[1, 3, 4, 5]
['khush', 'nishu', 'priti']
['khush', 'nishu', 'priti', 'jinu']
['khush', 'nishu', 'siya', 'priti', 'jinu']
['khush', 'nishu', 'priti']
['khush', 'priti']
['priti']
[1, 2, 3, 4, 5]
length is 5
1
2
3
4
5
['khush', 'keri', 'ketan', 'khushi']
after sorting :
['keri', 'ketan', 'khush', 'khushi']
['khush', 'keri', 'ketan', 'khushi']
after reverse :
['khushi', 'ketan', 'keri', 'khush']
['khush', 'keri', 'ketan', 'khushi']
khushi
keri
maximum and minimum in numbers
[1, 2, 3, 4, 5]
5
1
[1, 2, 3, 4, 5]
5
1
[]

Python Lambda

8) Program :


a = 5
b = 2

sum = a+b
print("sum is : "+str(sum))

a = 5
b = 2

sub = a-b
print("substraction is : "+str(sub))

a = 5
b = 2

mul = a*b
print("multiplication is : "+str(mul))

a = 5
b = 2

div = a/b
print("divison is : "+str(div))

a = 5
b = 2

mod = a%b
print("modulo is : "+str(mod))

Output :


sum is : 7
substraction is : 3
multiplication is : 10
divison is : 2.5
modulo is : 1

Python Break

9) Program :


a='khush'
print("without break statement")
for i in a:
    print(i,end='')
print()

print ("with break statement")
for i in a :
    if i=='u' :
        break
    print(i)

for i in range (1,11):
    if i==6:
        break
    print(i)

for i in range (1,11):
    if i==6:
        continue
    print(i)

Output :


without break statement
khush
with break statement
k
h
1
2
3
4
5
1
2
3
4
5
7
8
9
10

You May Also Like This Article :


Python Class

10) Program :


class Student:   
    def __init__(self, name): 
        print("This is parametrized constructor") 
        self.name = name 
    def show(self): 
        print("Hello",self.name) 
student = Student("Nibkarma") 
student.show()

Output :


This is parametrized constructor
Hello Nibkarma

11) Program :


def func():
    print("def called")
func()

def func(name):
    print("hi "+ name)
func('khush')

def value(a):
    print("a is "+str(a))
value(10)

def func(name):
    print("name is :"+name)
s=input("enter name:")
func(s)

def func(name):
    msg=print("hi "+name)
    return msg;
name=input("enter name :")
func(name)

Output :


def called
hi khush
a is 10
enter name:khush
name is :khush
enter name :khush
hi khush

Python Data-types

12) Program :



x=2
y=3.4
z=False

print(x)
print(y)
print(z)


x = 2
y = 3
sum = x+y
print(sum)

a=int(input("Enter a:"))
b=int(input("Enter b:"))
print("\n")

sum = a+b
sub = a-b
mul = a*b
div = a/b
mod = a%b

print(sum)
print(sub)
print(mul)
print(div)
print(mod)

Output :


2
3.4
False
5
Enter a: 3
Enter b:4


7
-1
12
0.75
3

Simple Python Programs :


1) Program :


Python program to print Hello World.

# This prints Hello World on the output screen
print('Hello World')

Output :


Hello World

2) Program : 


For Getting input in Python by user.

str = input("Enter any string: ")
print(str)

Output :


Enter any string: NibKarma
NibKarma

3) Program : 


Python program to check if a number is positive or negative.

number = int(input("Enter number: "))

# checking the number
if number < 0: print("The entered number is negative.") elif number > 0:
    print("The entered number is positive.")
elif number == 0:
    print("Number is zero.")
else:
    print("The input is not a number")

Output :


Enter Number: 200
The entered number is positive.

4) Program :


Python program to check leap year.

year = int(input("Enter Year: "))

# Leap Year Check
if year % 4 == 0 and year % 100 != 0:
    print(year, "is a Leap Year")
elif year % 100 == 0:
    print(year, "is not a Leap Year")
elif year % 400 ==0:
    print(year, "is a Leap Year")
else:
    print(year, "is not a Leap Year")

Output :


Enter Year: 2016
2016 is a Leap Year

5) Program :


Python program to check whether the input character is an alphabet.

ch = input("Enter a character: ")
if((ch>='a' and ch<= 'z') or (ch>='A' and ch<='Z')):
    print(ch, "is an Alphabet")
else:
    print(ch, "is not an Alphabet")

Output :


Enter a character : N
N is an alphabet

6) Program :


Python program to check vowel or consonant.

ch = input("Enter a character: ")

if(ch=='A' or ch=='a' or ch=='E' or ch =='e' or ch=='I'
 or ch=='i' or ch=='O' or ch=='o' or ch=='U' or ch=='u'):
    print(ch, "is a Vowel")
else:
    print(ch, "is a Consonant")

Output :


Enter a character : I
I is a Vowel

The Reasons  For Why Writing Software Applications in Python


1) Readable and Maintainable Code
2) Multiple Programming Paradigms
3) Compatible with Major Platforms and Systems
4) Robust Standard Library
5) Many Open Source Frameworks and Tools
6) Simplify Complex Software Development
7) Adopt Test Driven Development

The Python Applications :


1) Web and Internet Development
2) Applications of Python Programming in Desktop GUI
3)  Science and Numeric Applications
4) Software Development Application
5) Python Applications in Education
6) Python Applications in Business
7) Database Access
8) Network Programming
9) Games and 3D Graphics
10) Console-based Applications
11) Audio – or Video- based Applications
12) Applications for Images
13) Enterprise Applications
14) 3D CAD Applications
15) Computer Vision
16) Machine Learning
17) Robotics
18) Web Scraping
19) Scripting
20) Artificial Intelligence
21) Data Analysis


You can also learn :

You Also Can Search For Other Python Keywords Like :

Python , Python For Loop  , Python Loops  , Python Tutor  , Python Tutorial  , Python Dictionary  , Python Learning  , For Python List  , Python List  , Python Anaconda  , Python Download  , Python Range  , Python Regex  , Python Else If  , Python If Else  , Python Programming  , Python Snake  , Python Class  , Python Set  , Python In Function  , Python Function  , Python 3  , Python Pandas  , Python Random  , Python Array  , Python Requests  , Python Tuple  , Python Enumerate  , Python Write To File  , Python IDE  , Python Logger

 Python String  , Python While Loop  , Python Map  , Python Install  , Python Read File  , Python Code  , Python Flask  , Python Json  , Python Operator  , Python Or Operator  , Python Zip  , Python Compiler Online  , Python Online Compiler  , Python Online  , Python Replace  , Python Join  , Python Unit Testing  , Python Unittest  , Python Machine Learning  , Python With Machine Learning  , Python Certification  , Why Python For Machine Learning  , Python Interview Questions  , Python gui  , Python Reverse String  , Python Compiler

The Python Regular Expression  , Python Queue  , Python 2.7  , Python Yield  , Python Web Scraping  , Python IDE Online  , Python Django  , Python Scripting  , Python Numpy  , Python Multithreading  , For Python  , Python Or  , Python Generator  , Python For Windows  , Python 3.7  , With Python  , Python Documentation  , Python Version  , Python Beginners  , Python For Beginners  , Python Language  , Python List Functions  , Python Projects  , Python Data Structures  , Python Mysql  , Python Library  , Python And  , Python w3schools  , Python Modules  , Python Hello World  , Python Data Types  , Python 3.6  , Python Interpreter

Python Keyerror  , Python Ord  , Python Meaning  , Python Ordereddict  , Python Xrange  , Pythonanywhere  , Python Range Function  , Python For Data Analysis  , Python With Data sScience  , Python For Data Science  , Python Basics  , Python Interpreter Online  , Python Online interpreter  , Python Cheat Sheet  , Python Cheat Sheet  , Python vs Java  , Python Syntax  , Python Xml Parser  , Python Xml Parsing  , Python Join List  , Python Editor

Methods Of Python List !!

Methods Of Python List !!



In this article we will discuss about all methods of python lists.

Methods of lists are used to perform different operations in python.

The given below List of python methods for different purpose.

Methods


  • append() Method
  • insert() Method
  • clear() Method
  • copy() Method
  • sort() Method
  • count() Method
  • reverse() Method
  • remove() Method
  • len() Method
  • min() and max() Method

Python List


As we discussed in our previous article Python Lists is used for store the sequence data items,values of different datatypes.

It stores data in list as a array.

Values separated by the comma (,) and enclosed with [] brackets.

Index starts from 0 to n.

Program :


Output :

['khush', 'jinu', 'ashu', 'shwetu']
['a', 'b', 'c']
[1, 2, 3]
[1, 'khush']


Append() 


Append is used for insert the data in the list.

It insert data in the last of list.

Append is used the insert data without delete any item of existing list.

We can not insert at any number of index it add only in end of list.

Syntax : list.append()

Insert()


Insert is also used for insert data at any index in list.

when we insert data at any existing index then previous data is not delete only except number of index is changed.

Insert has two argument first is index number and second is data value.

Syntax : list.insert()

Program :


Output :

['khush', 'nishu', 'priti']
['khush', 'nishu', 'priti', 'jinu]
['khush', 'nishu', 'siya', 'priti', 'jinu]

In this example first we use append so, jinu add at the end of list.
second we use insert(2,"siya").so, at n[2] siya is stored and all priti is stored in next index.

Clear() 


clear() method is used for clear all data elements of the list.

list become null. it means there is list exist but no data item is available in the list.

Syntax : list.clear()

Program :


Output :

[1,2,3,4,5]
5
1
[]    ## when clear applied

as shown in above example there is still list exist and all data of list is clear.

Copy()


Python copy method is used to copy the elements of one list to the other list.

Syntax : list.copy() or list [:]

Program :







Output :

list l1 : [1,2,3,4]
after copy list l2 : [1,2,3,4]


Sort()


Sort() method is used for arrange the data of list in order and print in sorted form.

If we use string then it arrange according to alphabets order and if we use number then it sort by numbering.

Syntax : list.sort()

Program :


Output :

['khush' 'keri', 'ketan', 'khushi']
after sorting
['khushi', 'khush', 'keri', 'ketan']

as shown in above program string sorted alphabetically.

we can us also number for sorting or characters.

Count()


Count method returns how many times an element is stored in list.

Syntax : list.count()

Program :





Output :

count of 2 : 3

It returns 3 because in the list number 2 appears for 3 times.

Reverse()


Reverse() method use for store all data items of list in reverse order.

It means the first element store to the second elements stored in second last index and at end last element stored first.

Syntax : list.reverse()

Program :


Output :

['khush', 'keri', 'ketan', 'khushi']
after reverse :
['khushi', 'ketan', 'keri', 'khush']

as shown in program it just store in reverse order.

Remove()


Remove() method is used to remove data from the list.

we can remove with two method :
    1) Using data value
    2) By index number

In using data we directly remove by the value.

Syntax : list.remove("value")

In index number we use number of index for remove data.

Syntax : list.remove(list[number])

Program :


Output :

['khush,' 'nishu', 'priti']
['khush', 'priti']
['priti']

Len() Method 


Len() method gives length of list.

it gives how many number of data stored in list.

Syntax : len(list)

Program :


Output :

length is 5

Max() And Min() Method


This method is used to store the maximum element of the list.

Syntax : max(list)

This method is used to store the minimum element of the list.

Syntax : min(list)

Program :


Output :

['khush', 'keri', 'ketan', 'khushi']
khushi
ketan
maximum and minimum in number
[1, 2, 3, 4, 5]
5
1

As shown in above example it gives maximum and minimum value of both numbers and strings.

In this article we discussed about methods of python lists which is used to do different perations on python list.






Things You Should Know About Python Before Learning Python :


Python is an interpreted, high-level, general-purpose programming language. Developed by Guido van Rossum and first released in 1991,

Basic Programs Of All Python Methods


1) Program :


Python program to print Hello World.

# This prints Hello World on the output screen
print('NibKarma')

Output :


Hello NibKarma

List Programs

2) Program :



def string_length(str):
    count = 0
    for char in str:
        count += 1
    return count
print(string_length('NibKarma'))


Output : 8

Python Dictionary

3) Program :


def char_frequency(str):
    dict = {}
    for n in str:
        keys = dict.keys()
        if n in keys:
            dict[n] += 1
        else:
            dict[n] = 1
    return dict
print(char_frequency('NibKarma'))

Output :


{'a': 2, 'N': 1, 'i': 1, 'K': 1, 'r': 1, 'm': 1}

Python Tuple 

4) Program :

tuple=('a','b','c','d','e')
print(tuple)
del tuple[1]
print(tuple)

Output :


('a', 'b', 'c', 'd', 'e')

5) Program :



a = "Hello world"
print(a)
print(a[0])
print(a[1])
print(a[2])

x = "Hello"
y = "Khush"
print(x+y)

s = "Hello Khush"
print(s[0:2])
print(s[2:7])
print(s[4:])

Output :


Hello world
H
e
l
HelloKhush
He
llo K
o Khush

Python Pass

6) Program :


l=[1,2,3,4,5]
for i in l:
    if i==3:
        pass
        print ("Pass execute")
        print("Hello khush")
    print(i)

Output :


1
2
Pass execute
Hello khush
3
4
5

Python List

7) Program :



a1=["khush","jinu","ashu","shwetu"]
print(a1)
a3=['a','b','c']
print(a3)
a5=[1,2,3]
print(a5)
a6=[1,'khush']
print(a6)


a=['a','b','c','d','e']
print(a)
a[2]=3
print(a)
a[1:3]=1,2
print(a)
a[0:]=1,2,3,4,5
print(a)
del a[1]
print(a)

n=["khush","nishu","priti"]
print(n)
n.append("jinu")
print(n)
n.insert(2,"siya")
print(n)

n=["khush","nishu","priti"]
print(n)
n.remove("nishu")
print(n)
n.remove(n[0])
print(n)

n=[1,2,3,4,5]
print(n)
print("length is "+str(len(n)))

n=[1,2,3,4,5]
for i in n:
    print(i)

a=["khush","keri","ketan","khushi"]
print(a)
print("after sorting :")
a.sort()
print(a)

a=["khush","keri","ketan","khushi"]
print(a)
print("after reverse :")
a.reverse()
print(a)

a=["khush","keri","ketan","khushi"]
print(a)
n=max(a)
print(n)
n=min(a)
print(n)

print("maximum and minimum in numbers")

a=[1,2,3,4,5]
print(a)
n=max(a)
print(n)
n=min(a)
print(n)

a=[1,2,3,4,5]
print(a)
n=max(a)
print(n)
n=min(a)
print(n)
a.clear()
print(a)


Output :


['khush', 'jinu', 'ashu', 'shwetu']
['a', 'b', 'c']
[1, 2, 3]
[1, 'khush']
['a', 'b', 'c', 'd', 'e']
['a', 'b', 3, 'd', 'e']
['a', 1, 2, 'd', 'e']
[1, 2, 3, 4, 5]
[1, 3, 4, 5]
['khush', 'nishu', 'priti']
['khush', 'nishu', 'priti', 'jinu']
['khush', 'nishu', 'siya', 'priti', 'jinu']
['khush', 'nishu', 'priti']
['khush', 'priti']
['priti']
[1, 2, 3, 4, 5]
length is 5
1
2
3
4
5
['khush', 'keri', 'ketan', 'khushi']
after sorting :
['keri', 'ketan', 'khush', 'khushi']
['khush', 'keri', 'ketan', 'khushi']
after reverse :
['khushi', 'ketan', 'keri', 'khush']
['khush', 'keri', 'ketan', 'khushi']
khushi
keri
maximum and minimum in numbers
[1, 2, 3, 4, 5]
5
1
[1, 2, 3, 4, 5]
5
1
[]

Python Lambda

8) Program :


a = 5
b = 2

sum = a+b
print("sum is : "+str(sum))

a = 5
b = 2

sub = a-b
print("substraction is : "+str(sub))

a = 5
b = 2

mul = a*b
print("multiplication is : "+str(mul))

a = 5
b = 2

div = a/b
print("divison is : "+str(div))

a = 5
b = 2

mod = a%b
print("modulo is : "+str(mod))

Output :


sum is : 7
substraction is : 3
multiplication is : 10
divison is : 2.5
modulo is : 1

Python Break

9) Program :


a='khush'
print("without break statement")
for i in a:
    print(i,end='')
print()

print ("with break statement")
for i in a :
    if i=='u' :
        break
    print(i)

for i in range (1,11):
    if i==6:
        break
    print(i)

for i in range (1,11):
    if i==6:
        continue
    print(i)

Output :


without break statement
khush
with break statement
k
h
1
2
3
4
5
1
2
3
4
5
7
8
9
10

Python Class

10) Program :


class Student:   
    def __init__(self, name): 
        print("This is parametrized constructor") 
        self.name = name 
    def show(self): 
        print("Hello",self.name) 
student = Student("Nibkarma") 
student.show()

Output :


This is parametrized constructor
Hello Nibkarma

11) Program :


def func():
    print("def called")
func()

def func(name):
    print("hi "+ name)
func('khush')

def value(a):
    print("a is "+str(a))
value(10)

def func(name):
    print("name is :"+name)
s=input("enter name:")
func(s)

def func(name):
    msg=print("hi "+name)
    return msg;
name=input("enter name :")
func(name)

Output :


def called
hi khush
a is 10
enter name:khush
name is :khush
enter name :khush
hi khush

Python Data-types

12) Program :



x=2
y=3.4
z=False

print(x)
print(y)
print(z)


x = 2
y = 3
sum = x+y
print(sum)

a=int(input("Enter a:"))
b=int(input("Enter b:"))
print("\n")

sum = a+b
sub = a-b
mul = a*b
div = a/b
mod = a%b

print(sum)
print(sub)
print(mul)
print(div)
print(mod)

Output :


2
3.4
False
5
Enter a: 3
Enter b:4


7
-1
12
0.75
3

Simple Python Programs :


1) Program :


Python program to print Hello World.

# This prints Hello World on the output screen
print('Hello World')

Output :


Hello World

2) Program : 


For Getting input in Python by user.

str = input("Enter any string: ")
print(str)

Output :


Enter any string: NibKarma
NibKarma

3) Program : 


Python program to check if a number is positive or negative.

number = int(input("Enter number: "))

# checking the number
if number < 0: print("The entered number is negative.") elif number > 0:
    print("The entered number is positive.")
elif number == 0:
    print("Number is zero.")
else:
    print("The input is not a number")

Output :


Enter Number: 200
The entered number is positive.

4) Program :


Python program to check leap year.

year = int(input("Enter Year: "))

# Leap Year Check
if year % 4 == 0 and year % 100 != 0:
    print(year, "is a Leap Year")
elif year % 100 == 0:
    print(year, "is not a Leap Year")
elif year % 400 ==0:
    print(year, "is a Leap Year")
else:
    print(year, "is not a Leap Year")

Output :


Enter Year: 2016
2016 is a Leap Year

5) Program :


Python program to check whether the input character is an alphabet.

ch = input("Enter a character: ")
if((ch>='a' and ch<= 'z') or (ch>='A' and ch<='Z')):
    print(ch, "is an Alphabet")
else:
    print(ch, "is not an Alphabet")

Output :


Enter a character : N
N is an alphabet

6) Program :


Python program to check vowel or consonant.

ch = input("Enter a character: ")

if(ch=='A' or ch=='a' or ch=='E' or ch =='e' or ch=='I'
 or ch=='i' or ch=='O' or ch=='o' or ch=='U' or ch=='u'):
    print(ch, "is a Vowel")
else:
    print(ch, "is a Consonant")

Output :


Enter a character : I
I is a Vowel

The Reasons  For Why Writing Software Applications in Python


1) Readable and Maintainable Code
2) Multiple Programming Paradigms
3) Compatible with Major Platforms and Systems
4) Robust Standard Library
5) Many Open Source Frameworks and Tools
6) Simplify Complex Software Development
7) Adopt Test Driven Development

The Python Applications :


1) Web and Internet Development
2) Applications of Python Programming in Desktop GUI
3)  Science and Numeric Applications
4) Software Development Application
5) Python Applications in Education
6) Python Applications in Business
7) Database Access
8) Network Programming
9) Games and 3D Graphics
10) Console-based Applications
11) Audio – or Video- based Applications
12) Applications for Images
13) Enterprise Applications
14) 3D CAD Applications
15) Computer Vision
16) Machine Learning
17) Robotics
18) Web Scraping
19) Scripting
20) Artificial Intelligence
21) Data Analysis



You Also Can Search For Other Python Keywords Like :


Python , Python For Loop  , Python Loops  , Python Tutor  , Python Tutorial  , Python Dictionary  , Python Learning  , For Python List  , Python List  , Python Anaconda  , Python Download  , Python Range  , Python Regex  , Python Else If  , Python If Else  , Python Programming  , Python Snake  , Python Class  , Python Set  , Python In Function  , Python Function  , Python 3  , Python Pandas  , Python Random  , Python Array  , Python Requests  , Python Tuple  , Python Enumerate  , Python Write To File  , Python IDE  , Python Logger

 Python String  , Python While Loop  , Python Map  , Python Install  , Python Read File  , Python Code  , Python Flask  , Python Json  , Python Operator  , Python Or Operator  , Python Zip  , Python Compiler Online  , Python Online Compiler  , Python Online  , Python Replace  , Python Join  , Python Unit Testing  , Python Unittest  , Python Machine Learning  , Python With Machine Learning  , Python Certification  , Why Python For Machine Learning  , Python Interview Questions  , Python gui  , Python Reverse String  , Python Compiler

The Python Regular Expression  , Python Queue  , Python 2.7  , Python Yield  , Python Web Scraping  , Python IDE Online  , Python Django  , Python Scripting  , Python Numpy  , Python Multithreading  , For Python  , Python Or  , Python Generator  , Python For Windows  , Python 3.7  , With Python  , Python Documentation  , Python Version  , Python Beginners  , Python For Beginners  , Python Language  , Python List Functions  , Python Projects  , Python Data Structures  , Python Mysql  , Python Library  , Python And  , Python w3schools  , Python Modules  , Python Hello World  , Python Data Types  , Python 3.6  , Python Interpreter

Python Keyerror  , Python Ord  , Python Meaning  , Python Ordereddict  , Python Xrange  , Pythonanywhere  , Python Range Function  , Python For Data Analysis  , Python With Data sScience  , Python For Data Science  , Python Basics  , Python Interpreter Online  , Python Online interpreter  , Python Cheat Sheet  , Python Cheat Sheet  , Python vs Java  , Python Syntax  , Python Xml Parser  , Python Xml Parsing  , Python Join List  , Python Editor