Wednesday, August 5, 2020

Easy Python Program for School Kids to find the Distance, Speed and Time [ Free Code ]

*****
Distance = Speed * Time , Using this formula anyone of these 3 quantities can be calculated if the other two are given.
*****

n = input("Enter the thing u want to calculate (speed, distance or time) : ")
if n.lower() == "speed":
a = float(input("Enter Distance (in km) : "))
b = float(input("Enter time (in hr) : "))
c = a/b
print("Speed is",c,"km/hrs")
print("Speed is",(a * 1000)/(b * 3600),"m/s")
elif n.lower() == "distance":
a = float(input("Enter speed (in km/hrs[as decimal]) : "))
b = float(input("Enter time (in hrs) : "))
print("Distance is",a * b,"kms")
print("Distance is",(a * b) * 1000,"m")
elif n.lower() == "time":
a = float(input("Enter Distance (in km) : "))
b = float(input("Enter Speed (in km/hr[as decimal]) : "))
print("Time is",a/b,"hrs")
print("Time is",(a/b) * 3600,"sec")
else:
print("brrr")