Programming Principles

•Problem specification –our approach must be to determine overall goals, but precise ones, and then slowly divide the work into smaller problems until they become of manageable size. •Program design –Each part of a large program must be well organized, clearly written, and thoroughly understood, •Choice of  data structures –How they are arranged in relation... Continue Reading →

Machine Learning

Briefing in Python Machine Learning (ML) is that field of computer science with the help of which the computer systems can provide a sense to data in much the same way as human beings do. It is a type of artificial intelligence that extracts patterns out of raw data by using an algorithm or method.... Continue Reading →

List Length in Python

The length of a list can be calculated in Python by using various methods. The built-in len() method in Python is widely used to calculate the length of any sequential data type. It calculates the number of elements or items in a list and returns the same as the length of the list. l=[2,4,6,8,10] print("The length of... Continue Reading →

Easy Python programs

Print the ASCII value of Characters charr =(input("Enter a charcater")) print("The ASCII value of '" + charr + "' is", ord(charr)) Find the roots of quadratic equation import cmath a = int(input("Enter the value of a ")) b = int(input("Enter the value of b ")) c = int(input("Enter the value of c ")) # calculating... Continue Reading →

Area and Circumference of circle in python

#area and circumference of circle rad=float(input("Enter the radius of the circle ")) area= 3.14*rad*rad print("Area of the circle of given radius is = ", area) circum= 2*3.14*rad print("Circumference of the circle of given radius is = ", circum)

Calculate Compound Interest using Python

Formula for compound interest : =final amount=initial principal balance=interest rate=number of times interest applied per time period=number of time periods elapsed def compound_interest(principle, rate, time): CI = principle * (pow((1 + rate / 100), time)) print("Compound interest : ", CI) p=int(input("Enter Principal amount: ")) r=int(input("Enter interest rate: ")) t=int(input("Enter time period: ")) compound_interest(p, r, t)

Calculate simple interest using python

Formula for simple interest is : (principal amount* rate of interest* time period)/100 SI= (P*R*T)/100 p=int(input("Enter the principal amount ")) r=int(input("Enter the interest rate per annum ")) t=int(input("Enter the time period in years ")) simple_interest=(p*r*t)/100 print("SIMPLE INTEREST = ", simple_interest)

LOOP LEARNING : Loop, Increment, Decrement

Example: While Loop i=1 while i <= 10:   print (i)   i=i+1 OUTPUT Example: Range Function print ("range(10) --> ", list(range(10))) print ("range(0,20) --> ", list(range(0,20))) print ("range(10,20) --> ", list(range(10,20))) print ("range(0,20,2) --> ", list(range(0,20,2))) print ("range(-10,-20,2) --> ", list(range(-10,-20,2))) print ("range(-10,-20,-2) --> ", list(range(-10,-20,-2))) OUTPUT Examples: For Loop for i in range(0,10):   print (i) OUTPUT for i in range(0,20,2):   print (i) OUTPUT for i in range(0,-10,-1):   print (i) OUTPUT Example: Print table of 5 for i in range(1,11):   print (5," * ", i , " = ", i * 5) OUTPUT Example: Sum all numbers from 1 to 10 s=0 for i in range(1,11):   s=s+i print ("Sum is --> ",s) OUTPUT

Python beginner’s programs.

(Without Inputs From User) "Hello World" in python. print ("Hello World") OUTPUT Adding two numbers in python. a = 10 b = 220 c = a + b        print (a, ” + “, b, ” –> “, c) OUTPUT Concatenation of Strings. a = "Bhagat" b =  "Singh" c = a + b    print (a, ” + “, b, ” –> “, c) OUTPUT (With Inputs From User) Adding Two Numbers in python. a = int(input(“Enter First No: “)) b = int(input(“Enter Second No: “)) c = a + b print (a, ” + “, b, ” –> “, c) OUTPUT Concatenation Of Strings. a = input(“Enter First String: “) b = input(“Enter Second String: “) c = a + b    print  (a, ” + “, b, ” –> “, c) OUTPUT

Why Python?

The canonical, “Python is a great first language”, elicited, “Python is great last language!” -Noah Spurrier Python is an easy to learn, powerful programming language. It has an efficient high-level data structure and a simple but efficacious approach to object-oriented programming. It has an elegant syntax and dynamic typing plus an interpreted nature. All these... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started