Question: PYTHON Question 1 A program is needed to read a distance in kilometres, convertthis distance to nautical miles and display the result. A kilometre represents
PYTHON
Question 1
A program is needed to read a distance in kilometres, convertthis distance to nautical miles and display the result.
- A kilometre represents 1/10,000 of the distance between theNorth Pole and the equator.
- A nautical mile is the distance defined as follows:
- There are 90 degrees, between the North Pole and theequator.
- Each degree contains 60 minutes, and
- A nautical mile is the distance corresponding to oneminute.
- That is, we have
10000 kilometres=90 ×60 nautical miles
Complete the program below to display the distance in nauticalmiles.
distanceInKms = float(input("Enter distance inkilometres: "))
# add statements to complete the program
Question 2
A program is needed to read a time duration in minutes, convertsthis duration to the equivalent days, hours and minutes, anddisplay the result.
For example, if the duration is 3520 minutes, the program shoulddisplay
days: 2, hours: 10, minutes: 40
Complete the program below to display the time duration in days,hours and minutes.
time = int(input("Enter the time duration in minutes:"))
# add statements tocomplete the program
Question 3
A program is needed that reads a string containing only digitsof 0 and 1, it then computes and displays the length of longestruns of zeros.
For example, suppose the string is “00110111000”. Then it hasthree runs of zeros, of length 2, 1 and 3. The length of thelongest run is therefore 3.
Complete the program below to display the length of the longestruns of zeros.
Hint: One way to solve this problem is to regard character “1”as the delimiter.
s = input("Enter a string consisting of 0 and 1 digits:")
# add statements to complete the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
