Top 20+ python projects with source code (2024)

Hello Guys ! Once again welcome to our new blog. In this blog i am going to tell you python projects with source code. So must check out the full article in the middle of the blog you will get our live class link on YouTube so can see live development of the projects.

Python projects for beginners

Here we will learn python projects for beginners step by step. In this blog i m going to tell you Python mini projects with source code.

In this blog, i am going to solve the your following queries

  • Python projects with source code free
  • Python projects with source code for final year
  • Python projects with source code for beginners
  • Python mini projects with source code
  • Python mini projects for college students
  • Python projects for students

python projects with source code

1) WAP to enter Name,Age,mobile number and Address one by one.

Code-

name=input(“enter name”)

age=int(input(“enter age”))

mobile=int(input(“enter mobile number”))

add=input(“enter address”)

print(“Name=”,name)

print(“Age=”,age)

print(“Mobile Number=”,mobile)

print(“Address=”,add)

2) WAP to enter 3 numbers and find their sum and average.

Code

a=int(input(“enter number 1”))

b=int(input(“enter number 2”))

c=int(input(“enter number 3”))

sum=a+b+c

avg=sum/3

print(“Sum=”,sum)

print(“Average=”,avg)




3) WAP to solve the quadratic equation

                            ax2+bx+c

Code

import cmath

a=float(input(“enter number 1”))

b=float(input(“enter number 2”))

c=float(input(“enter number 3”))

d=(b**2)-4*a*c

sol1=-b-cmath.sqrt(d)/(2*a)

sol2=-b+cmath.sqrt(d)/(2*a)

print(‘The solution are {0} and {1}’.format(sol1,sol2))

4) WAP to perform Swaping of two number without using third variable

Code

a=10

b=20

print(“Value a before swaping a=”,a)

print(“Value a before swaping b=”,b)

a,b=b,a

print(“Value a after swaping a=”,a)

print(“Value a after swaping b=”,b)

5) WAP To create Login Application

Code

user=input(“enter user name”)

pas=int(input(“enter password”))

if user==”python” and pas==123:

    print(“Welcome to our application”)

else:

    print(“Invalid username or password”)

6) WAP to create Table generate Application

Code

n=int(input(“Enter any number”))

i=1

while i<=10:

    t=n*i

    print(t)

    i=i+1

7) WAP to Generate number, square and Cube depending on user range.

Code

st=int(input(“enter starting range”))

end=int(input(“enter ending range”))

while st<=end:

    print(“Number=”,st)

    print(“Square=”,st*st)

    print(“cube=”,st*st*st)

    st=st+1

8) WAP to Calculate Simple Interest Depending on user choice

Code-

ch=’y’

while ch==’y’:

    p=int(input(“enter principal”))

    r=int(input(“enter rate of interest”))

    t=int(input(“enter time”))

    si=p*r*t/100

    print(“Simple interest=”,si)

    ch=input(“do you want to continue(y/n)”)

 9) WAP to input 10 integer. Calculate and print the average of only positive integer among them. Negative number should not be processes and 0 should treated as end of input.

sum=0

c=0

for i in range(10):

    n=int(input(“Enter the number”))

    if n==0:

        break

    if n<0:

        continue

    sum=sum+n

    c=c+1

avg=sum/c

print(“Average of Positive Integer=”,avg)




10) WAP to input two number one as numerator and second denominator. Calculate and print result of division of numbers.Program should repeat this process for 5 pair of number. Program should terminate its repetition when user input 0 as denominator.

i=1

while i<=5:

    n=int(input(“Enter Numerator”))

    d=int(input(“Enter Denominator”))

    if d==0:

        print(“Division by zero.. Loop Terminated!!”)

        break

    r=n/d

    print(“Result=”,r)

    i=i+1

print(“Program Over!!!”)

11) Write a program to create a List of 10 numbers. While traversing the List print all its elements and count how many of them are positive, negative and zero.

p=n=z=0

num=[5,-8,2,0,6,-2,4,0,6,-1]

print(“List elements….”)

for a in num:

    print(a,” “,end=””)

    if(a>0):

        p=p+1#1+1=2

    elif a<0:

        n=n+1#1

    else:

        z=z+1#1

print(“\n\nNo.of positives=”, p)

print(“No. of negatives=”, n)

print(“No. of zeros=”, z)

12) WAP which takes list of number as input and finds

    1. The largest number in the list
    2. The smallest number in the list
    3. Product of all the element in the list

Code

num=[54,67,8,32,90]

min=num[0]

max=num[0]

mul=1

for i in num:

    mul=mul*i

    if i>max:

        max=i

    if i<min:

        min=i

print(“Maximum=”,max)

print(“Minimum=”,min)

print(“Product”,mul)

13) WAP to combine two dictionary adding values for common keys

code

from collections import Counter

d1={‘a’:100,’b’:200,’c’:300}

d2={‘a’:300,’b’:200,’d’:400}

d=Counter(d1)+Counter(d2)

print(d)

14) WAP that takes sentence as input from the user and computes the frequency of each letter. Use a variable of dictionary type to maintain and show the frequency of each character.

Code

str1=input(“enter any string…”)

f={}

for i in str1:

    if i in f:

        f[i]+=1

    else:

        f[i]=1

print(“Count of all characters in”,str1,”is:\n”+str(f))

scope of variable in python example

15) Write a program to create a list of 5 names. The program should ask user to input a new name and index position to update the element with new name

name=[‘Aditi’,’Bhawna’, ‘Chetna’, ‘Dipika’, ‘Enabel’]

print(“The current List is: \n”, name)

k=input(“\nEnter a new name:”)

pos=int(input(“Enter the index to replace element: “))

name[pos]=k

print(“\nThe updated List = \n”, name)




16) Write a program to create a Tuple of age of 10 persons. While traversing the Tuple print all its elements and count how many of them are Major and Minor.

t=(54,3,56,65,11,32,54,19,1,10)

mj=mn=0

for i in t:

    if i>=18:

        mj=mj+1

    else:

        mn=mn+1

print(“No. of majors=”,mj)

print(“No. of minors=”,mn)

Subscribe Our Youtube Channel for more live project click on the below link

https://www.youtube.com/@olevelguruji

17) Write a program to input key for a dictionary of cricketer’s name. Check whether that key exist in the dictionary or not. If the key exist in the dictionary then give user a choice of deleting or updating that element.

cricker={1: “Sachin”, 2: “Dhoni”, 3:”Virat”, 4: “Rohit”, 5: “Rahane”}

c=int(input(“Enter a key: “))

if c in cricker:

    print(“Press 1 for Deleting the element”)

    print(“Press 2 for Updating the element”)

    ch=int(input(“Enter your choice…: “))

    if ch==1:

        print(“Deleted value is: “, cricker[c])

        del cricker[c]

    else:

        print(“Old Name:”, cricker[c])

        nm=input(“Enter new Cricketer’s Name:”)

        cricker[c]=nm

    print(“Final Dictionary Values are…”)

    for c in cricker:

        print(c, cricker[c])

else:

    print(“Key does not exist”)

18) Write a Program to input the value of x and calculate the result of the following equation

ex+cosx0+root(x)

from math import *

x=int(input(“enter x”))

a=exp(x)

b=cos(x*(3.14/180))

c=sqrt(x)

r=a+b+c

print(r)

19) Write a program using user defined function with default argument. Calculate and print percentage of three subject marks. Use 300 as default value for maximum marks.

Code

def per(a,b,c,mm=300):

    p=(a+b+c)*100/mm

    print(“Percentage=”,p)

per(85,74,96)

per(45,35,42,150)




20) Create area module in python and import in our program.

Code

area.py(creating module) 

def tarea(b,h):

    ar=(b*h)/2

    print(“Area of triangle=”,ar)

def carea(r):

    ar=3.14*r*r

    print(“Area of circle=”,ar)

calling module

from area import *

tarea(10,20)

carea(5)

Also Check Our Latest Uploads

Python user defined functions with examples(2024)

python modules create and import in python

Leave a Comment