Posts

Python Program

Python Program to Find the Number is Prime or Not Prime Number or Not : Python program to check the number is prime or not. If the number is divisible by 1 or itself then it is prime number else it is not a prime number. Program: a=[21,45,32,23,43,55] for j in range(0,6):     k=0     for i in range(2,a[j]//2+1):         if(a[j]%i==0):             k=k+1     if(k==0):         print(a[j]," is prime")     else:         print(a[j]," isn't prime") Output: 21  isn't prime 45  isn't prime 32  isn't prime 23  is prime 43  is prime 55  isn't prime

Python Data types

Image
Python Data Type  Data Types:  Data type is a classification of data that define the type of data or value that an object and variable can hold in computer programming during compiling. Python has build in data types such has list, dictionary and list in which object can be modulated after it is created but in numbers, strings and tuples object cannot be replaced. Difference between the Data Types in Python:

Python for loops

Image
Python for loops using len  Python for loop: In python for loop is used to iterate the sequence of value until the condition is satisfied from list, tuples and strings. Syntax:             for val in sequence:                  Body of statement Example:             for i in range(1,10):                   i=i*2                   print("the value of range is:",i)

Python version

Image
Python version 2 vs 3 What is python 2?           Python is widely used for application development such as Google,You tube etc.It is easy to learn, write and read.It supports both procedural and object oriented programming language .Python is an interpreter that does not run the whole code at once but it check the code line by line and finds the error will be displayed without proceeding further and gives the error message to the user. What is python 3?             Python is mainly developed for adding more feature and in order to bugs error. Python 2 and Python 3 is differ in syntax and handling.Python 3 is popular for adding more feature continuously.It implement multi-threading, supports GUI(graphical user interface). Difference between Python 2 and Python 3: Python 2 gets minimum support and additional features. Python 3 gets maximum features continuously and easy to fix error . ...