You are on page 1of 10

IP Project (Xll)

Ques1 PROGRAM OF AIRTHMETIC CALCULATOR

def add(x, y)

return x + y

def subtract(x, y):

return x - y

def multiply(x, y):

return x * y

def divide(x, y):

return x / y

print("Select operation.")

print("1.Add")

print("2.Subtract")

print("3.Multiply")

print("4.Divide")

while True:

choice = input("Enter choice(1/2/3/4): ")

if choice in ('1', '2', '3', '4'):

num1 = float(input("Enter first number: "))

num2 = float(input("Enter second number: "))

if choice == '1':

print(num1, "+", num2, "=", add(num1, num2))

elif choice == '2':


print(num1, "-", num2, "=", subtract(num1, num2))

elif choice == '3':

print(num1, "*", num2, "=", multiply(num1, num2))

elif choice == '4':

print(num1, "/", num2, "=", divide(num1, num2))

next_calculation = input("Let's do next calculation? (yes/no): ")

if next_calculation == "no":

break

else:

print("Invalid Input")
Ques2 PROGRAM TO FIND PASS OR FAIL

a=int(input("Marks In English Core:"))

b=int(input("Marks In Mathematics:"))

c=int(input("Marks In Accounts:"))

d=int(input("Marks In Economics:"))

e=int(input("Marks In Computer Science:"))

f=(a+b+c+d+e)*100/500

print("Your Marks In Percentage Is",f,"%")

if f>=33:

print('You have passed!')

else:

print('You have failed')


Ques3 PROGRAM TO CREATE BAR CHART DISPLAYING
POPULATION IN CITITES

import numpy as np
import matplotlib.pyplot as plt

X = ['HYDERABAD','BANGALORE','MUMBAI','DELHI']
Y = [6809970,8425970,12442373,11007835]

X_axis = np.arange(len(X))

plt.bar(X_axis - 0.2, Y, 0.4, label = 'POPULATION')

plt.xticks(X_axis, X)
plt.xlabel("CITIES")
plt.ylabel("Number of POPULATION")
plt.title("POPULATION IN CITITES ")
plt.legend()
plt.show()
ques4 PROGRAM TO PLOT CHART OF SIN AND COS

import matplotlib.pyplot as pl

import numpy as np

x = np.linspace(-np.pi, np.pi, 256, endpoint=True)

y = np.cos(x)

y1 = np.sin(x)

pl.plot(x,y)

pl.plot(x, y1)

pl.show()
ques5 WRITE A PROGRAM TO PLOT BAR CHART IN PYTHON TO
DISPLAY THE RESULT OF A SCHOOL FOR FIVE CONSECUTIVE
YEARS.

import matplotlib.pyplot as plt

years= [2015, 2016, 2017, 2018, 2019]

p=[98.50, 70.25, 55.20, 90.5, 61.50]

j=["b","g","r","m","c"]

plt.bar(years, p,width=0.4, color=j)

plt.xlabel("years")

plt.ylabel('"pass%"')

plt.title('Percentage of the school score in the year 2015-2019')

plt.show()
ques6 PROGRAM TO PLOT MULTIRANGE LINE CHART

import matplotlib.pyplot as plt

import numpy as np

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

y = [3,3,3,3,3]

plt.plot(x, y, label = "line 1", linestyle="-")

plt.plot(y, x, label = "line 2", linestyle="--")

plt.plot(x, np.sin(x), label = "curve 1", linestyle="-.")

plt.plot(x, np.cos(x), label = "curve 2", linestyle=":")

plt.legend()

plt.show()
ques7 PROGRAM TO PLOT SCATTER CHART

import numpy

import matplotlib.pyplot as plt

x = numpy.random.normal(5.0, 1.0, 1000)

y = numpy.random.normal(10.0, 2.0, 1000)

plt.scatter(x, y)

plt.show()
ques8 PROGRAM TO CREATE DATAFRAME DISPLAY DETAILS OF
TEACHER

import pandas as pd

dict = {'name':[" ","aparna", "pankaj", "sudhir", "Geeku"],

'degree': [" ","MBA", "BCA", "M.Tech", "MBA"],

'score':[0,90, 40, 80, 98]}

df = pd.DataFrame(dict)

print(df)
ques9 PROGRAM TO PLOT BAR CHART WITH GRID

import matplotlib.pyplot as plt

plt.rcParams["figure.figsize"] = [7.50, 3.50]

plt.rcParams["figure.autolayout"] = True

data = [3, 5, 9, 15, 12]

plt.bar(range(len(data)), data, color='green', alpha=0.5)

plt.grid(color='black', linewidth=1, axis='both', alpha=0.5)

plt.show()

You might also like