


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This will all about the project that is based on the informatics practical.
Typology: Assignments
1 / 34
This page cannot be seen from the preview
Don't miss anything!



























AKSHAT AGARWAL 4323 ROLL NO. 4
while True: print('1. for area of circle') print('2. for area of rectangle') print('3. for circumference of circle') print('4. for area of square') ch=int(input('enter your choice:enter 0 to exit')) if ch==1: r=int(input('enter the radius of the circle:')) a=3.14rr print('area of circle:',a) elif ch==2: l=int(input('enter the length:')) b=int(input('enter the breath:')) a=lb print('area of rectangle:',a) elif ch==3: r=int(input('enter the radius of the circle:')) c=2(int(3.14*r))
maxlength=x maxword=i print('substring with maximum length is:',maxword) OUTPUT: Q.3 WRITE A PROGRAM T0 CHECK WHETHER THE STRING IS A PALINDROME OR NOT. PROGRAM: str=input('enter the string:') l=len(str) p=l-l index= while(index<p): if(str[index]==str[p]): index=index+ p=p- else: print('string is not a palindrome') break else: print('string is a palinndrome')
SCL=dict() i= flag= n=int(input('enter number of entries:')) while i<=n: adm=input('\nenter admission no. of a student:') nm=input('enter name of the student') section=input('enter class and section:') per=float(input('enter the percentage of a student')) b=(nm,section,per) SCL[adm]=b l=SCL.keys() for i in l: print('\nadmno-',i,':') z=SCL[i] print('name\t','class\t','per\t') for j in z:
import matplotlib.pyplot as plt weeks=(1,2,3,4) prices=(25,30,60,40) plt.plot(weeks,prices,'r-.') plt.xlabel('no. of weeks') plt.ylabel('prices of onion') plt.title('change in price of onion') plt.show() OUTPUT: Q.7 First 10 terms of a Fibonacci series in a list namely fib:
fib=[0,1,1,2,3,5,8,13,21,34] WAP to plot Fibonacci terms and their square roots with two separate lines on the same plot. · The Fibonacci series should be plotted as a cyan line with ‘o’ markers having size as ‘5’ and edge-color as red PROGRAM: import matplotlib.pyplot as plt fib=(0,1,1,2,3,5,8,13,21,34) x=(1,2,3,4,5,6,7,8,9,10) sq=(0,1,1,4,9,25,64,169,441,1156) plt.plot(x,fib,color='cyan',marker='o',markersize=5,markeredg ecolor="red",label='fibonnaci series') plt.plot(x,sq,color='black',marker='+',markersize=7,markeredg ecolor="red",label='its square') plt.legend() plt.xlabel('no. os series') plt.ylabel('squares and series')
plt.ylabel("height") plt.title("painting") plt.show() OUTPUT: Q.9 Cosider the reference table given above and write a program to plat a bar chart from the medals won by Australia. PROGRAM: import matplotlib.pyplot as plt medals=('gold','silver','bronze') x=(1,2,3) y=(80,59,59) plt.bar(x,y,color='red') plt.xticks(x,medals) plt.title('Medals won my australia') plt.xlabel('medals categories')
plt.ylabel('no. of medals') plt.show() OUTPUT: Q.10 Cosider the reference table given above and write a program to plat a bar chart from the medals won by India. Make sure that the Gold, Silver, Bronze and Total tally is represented through different colours. PROGRAM: import matplotlib.pyplot as plt plt.xkcd() x=(1) y=(26) x1=(2)
plt.show() OUTPUT: Q.11 Cosider the reference table given above and write a program to plat a bar chart from the medals won by top four countries. Make sure that bars are separately visible. PROGRAM: import matplotlib.pyplot as plt medals=('gold','silver','bronze') x=(1,2,3) y=(80,59,59) x1=(1,2,3) y1=(45,45,46) x2=(1,2,3)
y2=(26,20,20) x3=(1,2,3) y3=(15,40,27) plt.subplot(4,1,1) plt.bar(x,y,color='red') plt.title('AUSTRALIA') plt.xticks(x,medals) plt.subplot(4,1,2) plt.bar(x1,y1,color='yellow') plt.title('ENGLAND') plt.xticks(x,medals) plt.subplot(4,1,3) plt.bar(x2,y2,color='blue') plt.title('INDIA') plt.xticks(x,medals) plt.subplot(4,1,4) plt.bar(x3,y3,color='green') plt.title('CANADA') plt.xlabel('medals categories') plt.tight_layout() plt.xticks(x,medals) plt.show() OUTPUT:
Q.13 WAP that gathers height and weights of 100participants and recorded participants ages as : ages= [1,1,2,3,……………………..100 values](take any random values) WAP to plot a histogram from above data with 20 bins. PROGRAM: import matplotlib.pyplot as plt import numpy as np
ages=np.random.randn(100) wieght=np.random.randn(100) plt.hist(ages,bins=20,weights=wieght,edgecolor='red',facecolo r='blue') plt.xlabel('ages') plt.ylabel('wieghts') plt.title('wieghts of 100 students') plt.show() OUTPUT: Q.14 WAP TO PLOT A HISTOGRAM OF RANDOM VALUES. PROGRAM: import matplotlib.pyplot as plt import numpy as np
import pandas as pd s=pd.Series([10,20,30,40],index=['a','b','c','d']) print(s) OUTPUT: Q.17 WAP TO CREATE SERIES USING ARANGE FUNCTION OF NP ARRAY.
import pandas as pd import numpy as np s=pd.Series(np.arange(2,7)) print(s) OUTPUT: Q.18 WAP TO PERFORM ARTHEMETIC OPERATIONS ON SERIES. PROGRAM: import pandas as pd s1=pd.Series([1,2,3,4,5]) s2=pd.Series([3,4,5,6,7]) s3=pd.Series([5,6,7,8,9]) r1=s1+s print('sum') print(r1) r2=s1-s print('difference') print(r2) r3=s1*s print('multiplication') print(r3)