You are creating a simple Python script that takes a distance and a completion time and outputs the speed in knots, miles per hour, and feet per second.
Using variables write a script that defines a distance of 60 miles and a completion time of 3 hours. The output should show a completion speed in miles per hour, knots, and feet per second.
Here are some hints:
Go to yourmain.pyfile.
On the first two lines, declare two variables for the distance in miles and time in hours and assign the values60and3, respectively.
In the next two lines, calculate the distance in knots and distance in feet based on the distance in miles.
Then, calculate the time in seconds based on the time in hours.
Next, calculate the speed in knots, speed in miles per hour, and speed in feet per second.
Finally, addprintstatements to print out the results.
print
In your terminal, run the script by using thepython3 main.pycommand.
The output should be likeFigure 1.8, shown below:
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here