0% found this document useful (0 votes)
77 views

Python QP Solution Module 1 ND 2

This Python program contains code to calculate the area of basic shapes like square, rectangle, and circle by taking user input for dimensions. It also contains functions to find the minimum and maximum characters in a string, calculates length, sum and average of a list of numbers.

Uploaded by

manjulakinnal
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)
77 views

Python QP Solution Module 1 ND 2

This Python program contains code to calculate the area of basic shapes like square, rectangle, and circle by taking user input for dimensions. It also contains functions to find the minimum and maximum characters in a string, calculates length, sum and average of a list of numbers.

Uploaded by

manjulakinnal
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/ 5

JAN 2020 QP Solutions1)

print('enter the sides of a square')


side=input()
area_square=int(side)*int(side)
print('area of a square is ' +str(area_square))
print('enter the length and breadth of a rectangle')
length=input()
breadth=input()
area_rectangle=int(length)*int(breadth)
print('area of a rectangle is ' +str(area_rectangle))
print('enter the radius of a circle')
radius=input()
area_circle=3.142*int(radius)*int(radius)
print('area of a circle is ' +str(area_circle))
def max(name):
max1='Z'
for i in name:
if i>max1:
max1=i
return max1
def min(name):
min1='a'
for i in name:
if i<min1:
min1=i
return min1
var1='abcd'
result=min(var1)
result1=max(var1)
print('minimum of string is '+str(result),end=' and ')
print('maximum of string is '+str(result1))
count=0
for i in var1:
count=count+1
print('length of the string is ' + str(count))
num=[1,2,3,4,5]
sum=0
count=0
for i in range(len(num)):
sum=sum+num[i]
count=count+1
average=sum/count
print('sum of the numbers is'+str(sum))
print('average of the numbers is'+str(average))
print('count of the numbers is'+str(count))

JAN 2019:
1) WRITE A PYTHON PROGRAM TO DISPLAY FORMAT OF THE NUMBER
Fn=22n+1, taking n as a input
[4marks]

print('enter n')
n=input()
n1=int(n)
value=(2**(2*n1))+1
print('result is'+str(value))

2)

sp=int(input("Enter Marks of Sport event"))

ac=int(input("Enter Marks obtain for Activity"))

f=(sp+ac)*100/100

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

Write a python program to convert celsius to farenheit


celsius=int(input('enter the temperature in celsius'))
fahrenheit=(celsius*9/5) +32
print(fahrenheit)

Note: formulas for calculation


Celsius=(Fahrenheit-32)*5/9
fahrenheit=(celsius*9/5) +32

You might also like