0% found this document useful (0 votes)
12 views8 pages

Jaga S and A

Uploaded by

gamerquadratic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

Jaga S and A

Uploaded by

gamerquadratic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

19.#Program to convert Decimal to Binary,Octal and Hexadecimal.

CODE:

dec=16

b=bin(dec)

o=oct(dec)

h=hex(dec)

print("Decimal number is:",dec)

print("Binary value is:",b)

print("Octal value is:",o)

print("Hexadecimal value is:",h)

OUTPUT:

BEFORE COMPILING

dec=16

b=bin(dec)

o=oct(dec)

h=hex(dec)

AFTER COMPILING
Decimal number is: 16
Binary value is: 0b10000
Octal value is: 0o20
Hexadecimal value is: 0x10
20.#Program to add 2 integers and 2 strings and print the result.

num1=19

num2=12

sum1=num1+num2

print("The sum of 2 integers is:",sum1)

str1="Jack"

str2="Rock"

sum2=str1+str2

print("The addition of 2 strings is:",sum2)

OUTPUT:

BEFORE COMPILING

num1=19

num2=12

sum1=num1+num2

str1="Jack"

str2="Rock"

sum2=str1+str2

AFTER COMPILING
The sum of 2 integers is: 31
The addition of 2 strings is: JackRock
21.#Program to find the sum of first 10 natural numbers.

num=7

sum=0

while(num>0):

sum=sum+num

num=num-1

print("The sum of first 10 natural number is:",sum)

OUTPUT:

BEFORE COMPILING

num=7

sum=0

while(num>0):

sum=sum+num

num=num-1

AFTER COMPILING
The sum of first 10 natural number is: 28
22.#Program to find whether the given number is ODD or EVEN.

num1=20

if(num1%2)==0:

print("EVEN")

else:

print("ODD")

OUTPUT:

BEFORE COMPILING

num1=20

if(num1%2)==0:

AFTER COMPILING
EVEN
23.#Program to find the variance and standard deviation for a given set of data.

import statistics

sample=[130,456,123,143]

var=statistics.pvariance(sample)

print("The variance is:",var)

sd=statistics.pstdev(sample)

print("The Standard Deviation is:",sd)

OUTPUT:

BEFORE COMPILING

sample=[130,456,123,143]

var=statistics.pvariance(sample)

sd=statistics.pstdev(sample)

AFTER COMPILING
The variance is: 19734.5
The Standard Deviation is: 140.47953587622646
24.#Python Program to display student marks from the record.

file=open("student","r")

lines=file.readlines()

for x in lines:

print(x)

file.close()

OUTPUT:
Student name : Marks Scored

BHUVAN : 90

KISHAN : 95

ADITYA : 98

APPU : 97
25.#Program to create a labelled Bar graph using matplotlib.pyplot.

import matplotlib.pyplot as plt

x=["Jagadish","Kishan","Roshan","Suresh","Dhoni"]
y=[74,23,80,34,56]

plt.title("Student Marks Bar Graph")


plt.xlabel("Student Name")
plt.ylabel("Marks")

plt.bar(x,y)

for(i,j)in zip(x,y):
plt.annotate(j,(i,j))

plt.show()

OUTPUT:

BEFORE COMPILING

x=["Jagadish","Kishan","Roshan","Suresh","Dhoni"]
y=[74,23,80,34,56]

AFTER COMPILING

26.#Program to create a labelled pie graph using matplotlib.pyplot.


import matplotlib.pyplot as plt

x=["Jagadish","Kishan","Roshan","Suresh","Dhoni"]
y=[74,23,80,34,56]

plt.title("Student Marks Pie Graph")

plt.pie(y,labels=x,autopct='%d')

plt.show()

OUTPUT:

BEFORE COMILING:

x=["Jagadish","Kishan","Roshan","Suresh","Dhoni"]
y=[74,23,80,34,56]

AFTER COMPILING:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy