Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (1 vote)
248 views

Python E Lab

The document contains examples of Python code for calculating areas, salaries, converting units, and other math problems. It includes multi-line code snippets that take user input and perform calculations to output results. The examples cover basic math operations, formatting output, splitting strings, and other Python programming concepts.

Uploaded by

thamizhan4341
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
248 views

Python E Lab

The document contains examples of Python code for calculating areas, salaries, converting units, and other math problems. It includes multi-line code snippets that take user input and perform calculations to output results. The examples cover basic math operations, formatting output, splitting strings, and other Python programming concepts.

Uploaded by

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

Level 1

Athika and Ritu got a nice job


basic=float(input())

sal=basic+(basic*0.8)+(basic*0.4)

print(f"{sal:.2f}")

Subash wants to find


pi= 3.142

r=float(input(""))

print("The area of the circle with radius",r,"is:",pi*r**2)

Area of the triangle


import math

s1=float(input(""))

s2=float(input(""))

s3=float(input(""))

s=(s1+s2+s3)/2

area=math.sqrt(s*(s-s1)*(s-s2)*(s-s3))

print("The area of triangle is",area)

Vignesh wants to display


name=input()

degree=input()

print("Name: {}\nDegree: {}".format(name,degree))

Pinnacio went to the school


G=int(input())

S=int(input())

print("The Range of given data =",G-S)

Aaron took his girl friend Binita


bill=int(input())

print("The Tax is {:.2f}\nThe Tip is {:.2f}\nTotal Bill With Tax and Tip is{:.2f}".format(bill*0.18,bill*0.05,(bill+bill*0.18+bill*0.05)))

Vetrivel wants to convert


days=int(input())

hours=int(input())

minutes=int(input())

seconds=int(input())
print(days*86400+hours*3600+minutes*60+seconds)

Arif planned to make a room


l=float(input())

b=float(input())

print("{:.2f}".format(l*b))

Thanvi’s maths teacher taught


r=float(input())

pi=3.142

print(4/3*pi*r**3)

Nancy bought apples


n1=int(input())

n2=int(input())

print("Quo ent:{}\nRemainder:{}".format(int(n1/n2),n1%n2))

Level 2
Caleb is a physicist
import math

d=float(input())

print("{:.2f} m/s".format(math.sqrt(2*d*9.8)))

Arav was a popular maths trainer


num=int(input())

print(num%10)

Surya was used to wear


me = int(input())

hour = int( me / 3600)

me %= 3600

minutes = int( me / 60)

me %= 60

print("{}H:{}M:{}S".format( hour, minutes, me))

Arul and Kani own the farm


r=float(input())

pi=3.14

print(f"{(pi*r**2):.2f}\n{(2*pi*r):.2f}")

Isaac loved to work


sq_feet = float(input())

acres = sq_feet / 43560

print(f"{sq_feet} sq. is equal to {acres:.2f} acres")

Nancy is a data scien st


lst=input().split()

print(f"EmployeeID : {lst[2]}\nArea Code : {lst[3]}\nHouse Number : {lst[0]}\nPincode : {lst[1]}")

Program to compute a+aa+aaa+aaaa


a=input()

print(int(a)+int(a+a)+int(a+a+a)+int(a+a+a+a))

Flipkart announced the year end


n=int(input())

print(f"{n} {n**2} {n**3}")

Nedumaran Rajangam is an visionary


n=int(input())*185

print(f"Regular Price={n}\nAmount Discounted={n*0.6:.2f}\nAmount to be paid={n*0.4:.2f}")

Jannu and Preethi both went to Egypt


b,h=map(float, input().split(" "))

print(f"{b*h/2:.3f}")

Level 3
Vignesh wants to format
txt=input().split(" ")

print("I have {} dollars so I can buy {} football for {:.2f} dollars.".format(txt[1],txt[0],float(txt[2])))

Janaki wants to convert


print((int(input()))+2)

Thanvi is a SSLC student


ap=input().split(",")

t=int(input())

print(int(ap[1])-int(ap[0])+int(ap[t-2]))

Bitwise XOR of integers


xor=input().split(" ")

print(int(xor[0])^int(xor[1]))

Ford once was going down


me = int(input())
day = int( me / (24 * 3600))

me = me % (24 * 3600)

hour = int( me / 3600)

me %= 3600

minutes = int( me / 60)

me %= 60

print("The Dura on is {} days {} hours {} minutes {} seconds".format(day, hour, minutes, me))

Tina successfully completed


basicPay = float(input())

employeeFund = 17.5

employerFund = 23.5

employeeShare = (basicPay * 17.5) / 100

employerShare = (basicPay * 23.5) / 100

print("{:.2f}".format(employeeShare))

print("{:.2f}".format(employerShare))

Johnson was working as a captain


n=int(input())

y=int(n/365)

d=n%365

m=int(d/30)

print("{} Y(s) {} M(s) {} D(s)".format(y,m,m%30))

Sudan had a task


x1, y1 = map(float, input().split(','))

x2, y2 = map(float, input().split(','))

x3, y3 = map(float, input().split(','))

x = (x1 + x2 + x3) / 3

y = (y1 + y2 + y3) / 3

print(f"({x:.2f},{y:.2f})")

Sathya is an mathema cal expert


base=float(input())

exp=float(input())

print(f"{base**exp:.2f}")

Krishna has just arrived in the city of Madhura


m, n = map(int, input().split(" "))
les_needed = (m * n) // 2

print(round( les_needed/2))

You might also like