0% found this document useful (0 votes)
10 views1 page

05 Lab

The document outlines a Python program that calculates travel details based on user inputs for starting location, destination, mode of transport, distance, and speed. It computes the estimated travel time and indicates whether a rest stop is recommended if the travel time exceeds 5 hours. The program provides a structured output of the travel information and warnings if applicable.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

05 Lab

The document outlines a Python program that calculates travel details based on user inputs for starting location, destination, mode of transport, distance, and speed. It computes the estimated travel time and indicates whether a rest stop is recommended if the travel time exceeds 5 hours. The program provides a structured output of the travel information and warnings if applicable.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Romeo Jr M Manlocot

BSIT 3.2B
05_Laboratory_Exercise_1

start_location = input("Enter the starting location: ")


destination = input("Enter the destination: ")
mode_of_transport = input("Enter the mode of transport (e.g., car, bus, bike): ")

distance = float(input("Enter the distance (in kilometers): "))


speed = float(input("Enter the speed (in km/h): "))

travel_time = distance / speed

rest_stop_recommended = travel_time > 5

print("\n--- Travel Details ---")


print(f"Starting Location: {start_location}")
print(f"Destination: {destination}")
print(f"Mode of Transport: {mode_of_transport}")
print(f"Distance: {distance} km")
print(f"Speed: {speed} km/h")
print(f"Estimated Travel Time: {travel_time:.2f} hours")

if rest_stop_recommended:
print("Warning: Travel time exceeds 5 hours. A rest stop is recommended.")
else:
print("Travel time is within 5 hours. No rest stop is necessary.")

You might also like