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

Python

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Python

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

l=int(input('enter the length of the rectangle'))

b=int(input('enter the breadth of the rectangle'))

area = (l*b)

print ('the area of the rectangle is',area)

a=int(input("enter the value of x:"))

b=int(input("enter value of y:"))

c=int(input("enter the value of z:"))

roota=((-b+b**2-4*a*c)**0.5/(2*a))

rootb=((-b-b**2-4*a*c)**0.5/(2*a))

print("the first root is",roota)

print("the second root is",rootb)


age=int(input('enter your age please:'))

if(age>=18):

print("congratulations you are elgible to cast a vote")

else:

print("sorry you are not eligible to vote")

A=int(input("enter your number please:"))

if(A%2==0):

print("your number is even")

else:

print("your number is odd")


X=int(input("write the first number:"))

Y=int(input("write the second number:"))

if(X<Y):

print("the greater number is",Y)

else:

print("the greater number is", X)

P=int(input("wnter the first number:"))

Q=int(input("enter the second number:"))

R=int(input("enter the third number:"))

if(P>Q):

if(P>R):

print(P,'is the maximum value')

else:

print(R,'is the maximum value')

else:

if(Q>R):

print(Q,'is the maximum value')

else:

print(R,'is the maximum value')


name=input('enter your name')

ov=int(input('enter your overtime hours'))

ab=int(input('enter your absent hours'))

hour=(ov-((2/3)*ab))

if(ov>40):

pay=50

elif(ov>30):

pay=40

elif(ov>20):

pay=30

elif(ov>10):

pay=20

else:

pay=10

print('since you were absent for',ab,'hours and worked overtime for',ov,'hours therefore your bonus
pay is',pay)
x=input('what is your name:')

a=int(input('enter the marks for subject1:'))

b=int(input('enter the marks for subject2:'))

c=int(input('enter the marks for subject3:'))

d=int(input('enter the marks for subject4:'))

e=int(input('enter the marks for subject5:'))

Avg=((a+b+c+d+e)/5)

print(Avg)

if(Avg>=91):

grade='O'

elif(Avg>=80):

grade='A+'

elif(Avg>=70):

grade='A'

elif(Avg>=60):

grade='B+'

elif(Avg>=50):

grade='B'

elif(Avg>=40):

grade='C'

elif(Avg>=30):

grade='D'
elif(Avg<=30):

grade='F'

print(x,'your average marks are',Avg,

'and your grade is',grade)

n=int(input('enter a number'))

i=1

sum=0

while(i<=n):

sum=(sum+i)

i=(i+1)

print('the average of',n,'natural numbers is',sum/n)

year=int(input("Enter a year:"))

if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):

print(f"{year} is a leap year.")

else:
print(f"{year} is not a leap year.")

n=int(input('enter a number'))

i,sum=1,0

while(i<=n):

sum=(sum+i)

i=(i+2)

print('sum of odd natural numbers till',n,'is:',sum)

You might also like