You are on page 1of 4

---------------------------solution1--------------------------------------

x11=map(int,input('Enter x1 for rectangle 1: '))


y11=map(int,input('Enter y1 for rectangle 1: '))
x12=map(int,input('Enter x2 for rectangle 1: '))
y12=map(int,input('Enter y2 for rectangle 1: '))

x21=map(int,input('Enter x1 for rectangle 2: '))


y21=map(int,input('Enter y1 for rectangle 2: '))
x22=map(int,input('Enter x2 for rectangle 2: '))
y22=map(int,input('Enter y2 for rectangle 2: '))

if x11<x12 and y11<y12:


length1 = x12-x11
breadth1 = y12-y11
area1 = length1*breadth1
print('length of rectangle 1 : %f\nbreadth of rectangle 1 : %f\nArea : %f'%
(length1,breadth1,area1))
else:
print("Wrong inputs for rectangle 1\n")

if x21<x22 and y21<y22:


length2 = x22-x21
breadth2 = y22-y21
area2 = length2*breadth2
print('length of rectangle 2 : %f\nbreadth of rectangle 2 : %f\nArea : %f'%
(length2,breadth2,area2))
else:
print("Wrong inputs for rectangle 2\n")

if x21<x12 and y21<y12:


print('Rectangles are overlapping\n')
length3 = x12-x21
breadth3 = y12-y21
area3 = length3*breadth3
print('length of overlapped rectangle : %f\nbreadth of overlapped rectangle :
%f\nArea : %f'%(length3,breadth3,area3))
else:
print("Rectangles doesn't overlap\n")
print('Total Area of overlapped rectangle is %f"%(area1+area2-area3))

--------------------------------------solution
2----------------------------------------------------------------------------------
--------

ba = int(input("Enter the bill amount:"))

if(ba>0 and ba<1000):


x=ba-(ba*0.05);
elif(ba>=1000 and ba<2000):
x=ba-(ba*0.07);
elif(ba>=2000 and ba<5000):
x=ba-(ba*0.09);
elif(ba>=5000):
x=ba-(ba*0.1);

print("The amount to be paid is {0}".format(x))


------------------------------------------solution 3
-----------------------------------------------------------------------------------
---

field_length = int(input('Length of the field(in meters) :'))


field_breadth = int(input('Breadth of the field(in meters) :'))
tin_length = int(input('Tin length(in meters) :'))
tin_breadth = int(input('Tin breadth(in meters) :'))
tin_height = int(input('Tin height(in meters) :'))
yields = int(input('Field yield(in cubic meters) :'))
area_tin = tin_length*tin_breadth*tin_height
field_area = field_length*field_breadth
total_yield = (yields*field_area)/10000
count= total_yield//area_tin
rem = total_yield%area_tin
print('Total completely filled tins %f\nPartially filled tins volume %f'%
(count,rem))

--------------------------------------------solution
4----------------------------------------------------------------------------------
-------
l = int(input("enter aravinds friends house position on coordinate line:"))

s = int(l/5)
if(l%5>0):
s=int(s+1);
print("minimum number of steps required= ",s);

--------------------------------------------solution
5----------------------------------------------------------------------------------
-------
n = int(input("enter the number: "))
c=0
for i in range(1,n+1):
if(n%i == 0):
print(i)
c = c+1

print("number of digits divisible by zero: {0}".format(c))

----------------------------------solution
6-----------------------------------------------

a = int(input("number of candels chaitanya has: "))


b = int(input("number of went of candels required to create a new candel: "))
d=a/b
if(1<=a<=1000):
if(2<=b<=1000):
c=a+d
else:
print("invalid details")
print("the room has candels light for {0} hours".format(c))

-------------------------------------solution
7-------------------------------------------
s = input("enter a string: ")
a = s.split(" ")
a.sort()
for i in a:
print("{0} = {1}".format(i,len(i)))

------------------------------------------solution
8---------------------------------------

import collections
od = collections.OrderedDict()

n=int(input("No.of student marks : "))


for x in range(0,n):
print("Input student ",x+1," name ")
s_name=input()
Phy=int(input("Physics marks:"))
Chem=int(input("Chemistry marks: "))
Mat=int(input("Maths marks: "))
Eng=int(input("English marks: "))
Hin=int(input("Hindi marks: "))
od[s_name] = Phy,Chem,Mat,Eng,Hin

lst=list()
for key, value in od.items():
if (isinstance(key, str)):
lst.append(value)

a=list(map(sum, zip(*lst)))
avg = ['%.2f' %(x / len(od)) for x in a]

print("Average marks of the class in Phy, Chem, Mat, Eng and Hin are as follows :
")
print(avg)

----------------------------------solution
9----------------------------------------------

inp=int(input(" No.of entries:"))


lst=list()
for x in range(0,inp):
print("Enter student",x+1,' value:')
a=int(input(" "))
lst.append(a)

lst.sort(reverse=True)

print(lst[1])

----------------------------------solution
10----------------------------------------------

y=int(input(" Enter the year:"))


if(y%4==0 and y%100==0 and y%400==0):
print(y," is a leap year\n")
else :
print("Not a leap year")

iot assignment1.txt
Displaying iot assignment1.txt.

You might also like