LEVEL-01-SOLN

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

INPUT & OUPUT

LEVEL - 01

PROBLEM 01

In [1]: s1 = int(input("Enter a first side:" ))


s2 = int(input("Enter a second side: "))
s3 = int(input("Enter a third side: "))

s = (s1+s2+s3)/2
area = (s*(s-s1)*(s-s2)*(s-s3))**0.5
print("The area of triangle is ", area)

The area of triangle is 6.0

PROBLEM 02

In [2]: d = int(input("Enter the number of days: "))


h = int(input("Enter the number of hours: "))
m = int(input("Enter the number of minutes: "))
s = int(input("Enter the number of seconds: "))

print(d*86400 + h*3600 + m*60 + s)

176461

PROBLEM 03

In [4]: r = float(input("Enter a radius: "))


pi = 3.14
vol = (4.0/3.0)*pi*r**3
print(vol)

70.24061098666668

PROBLEM 04

In [6]: name = input("Enter your first name: ")


d = input("Enter a degree and branch: ")
print("Name: {} \nDegree: {}".format(name, d))

Name: Manikandan
Degree: B.Sc Mathematics

PROBLEM 05

In [8]: m = int(input("Enter a time in minutes: "))


print("{} Hours and {} Minutes".format(m//60,m%60))

9 Hours and 6 Minutes


PROBLEM 06

In [10]: length = float(input("Enter a length: "))


width = float(input("Enter a width: "))
print(round(length*width,2))

523.42

PROBLEM 07

In [11]: r = float(input("Enter a radius: "))


area = 3.14*r**2
print("The area of the circle with radius {} is: {}".format(r, area))

The area of the circle with radius 1.1 is: 3.7994000000000008

PROBLEM 08

In [16]: s = int(input("Enter a number"))


s1 = 0
for i in str(2**s):
s1 += int(i)
print(s1)

115

PROBLEM 09

In [21]: basic = int(input("Enter the basic pay of the employee:" ))


gross = basic + 0.8*basic + 0.4*basic
print(round(gross, 2))

81697.0

PROBLEM 10

In [17]: x1 = int(input("Enter a x1 value:"))


y1 = int(input("Enter a y1 value:"))
x2 = int(input("Enter a x2 value:"))
y2 = int(input("Enter a y2 value:"))

d = ((x2-x1)**2 + (y2-y1)**2)**0.5
print(d)

2.8284271247461903

In [ ]:

You might also like