Question

Write a program using python that determines the distance to a lightning strike based on the...

Write a program using python that determines the distance to a lightning strike based on the time elapsed between the flash and the sound of thunder. The speed of sound is approximately 1120 ft/sec and 1 mile is 5280 ft.

You need to use a function for this program. It needs to take a single argument and return a single value.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code and output

Code for copying

t=int(input("ENter the time in seconds between the flash and thunder : "))
s=t*1120
print("The distance to a lightning strike is {} miles".format(s/5280))

Add a comment
Know the answer?
Add Answer to:
Write a program using python that determines the distance to a lightning strike based on the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3.44 Write a function distance that takes as input a number: the time elapsed (in sec-...

    3.44 Write a function distance that takes as input a number: the time elapsed (in sec- onds) between the flash and the sound of thunder. Your function should return the distance to the lightning strike in kilometers. The speed of sound is approximately 340.29 meters per second; there are 1000 meters in one kilometer. >>>distance (3) 1.0208700000000002

  • USING PYTHON IDLE 3.4: NEED HELP WITH THIS PLEASE! :( Question #8: You want to determine...

    USING PYTHON IDLE 3.4: NEED HELP WITH THIS PLEASE! :( Question #8: You want to determine the distance to lightning strikes during a storm. This can be measured using the time elapsed between seeing the lightning flash and hearing the thunder. You know that the speed of sound is approximately 1,100 ft/second and 1 mile is 5,280 feet. Write a program named q8.py that prompts the user for the number of lightning strikes to analyze and the number of seconds...

  • Distance from a lightning strike A general rule of thumb is that if you see lightning,...

    Distance from a lightning strike A general rule of thumb is that if you see lightning, there is one mile for every five seconds before the thunder is heard. Check this against the actual speed of sound Speed of sound at 20 C is approximately 343 m/s.

  • Write a Python program: In main function the user is asked to enter distance traveled and...

    Write a Python program: In main function the user is asked to enter distance traveled and time and then send this information to a Python function that calculates and returns the speed of a car. The function will need to have parameters for distance traveled and time taken for the travel. The speed is calculated as: Speed = distance traveled / time In the main function show how to call this function in a print statement.

  • Use Python 3.7 to write the following program: Given a list of n numbers, write a...

    Use Python 3.7 to write the following program: Given a list of n numbers, write a function to shift the numbers circularly by some integer k (k < n). The function should take a list, the amount to shift k, and an argument specifying the direction to shift (left or right). Suggestion: use the % operation and also you need a number between 0 inclusive and the length of the list.

  • how do i write a Python program in function. calc_fuel which takes two input parameters: distance...

    how do i write a Python program in function. calc_fuel which takes two input parameters: distance fuel_consumption. The function should calculate : fuel_needed = distance * fuel_consumption / 100. The function should then return fuel_needed. Now add the following lines at the end of main(): distance = 500 fuel_rate = 8 fuel = get_fuel(distance, fuel_rate) print(“Fuel needed is“, fuel)

  • 1(a)    Write a python program using a function name slope(x1, y1, x2, y2) that returns...

    1(a)    Write a python program using a function name slope(x1, y1, x2, y2) that returns the slope of the line through the points (x1, y1) and (x2, y2). 1(b) For problem 1(a), write a python program using a function name Euclidean_dist(x1, y1, x2, y2) which will calculate and return the Euclidean distance between the points (x1, y1) and (x2, y2).

  • Write the code in python programming Language String Statistics: Write a program that reads a string...

    Write the code in python programming Language String Statistics: Write a program that reads a string from the user and displays the following information about the string: (a) the length of the string, (b) a histogram detailing the number of occurrences of each vowel in the string (details provided below), (c) the number of times the first character of the string occurs throughout the entire string, (d) the number of times the last character of the string occurs throughout the...

  • Write a Python program to create userids: You work for a small company that keeps the...

    Write a Python program to create userids: You work for a small company that keeps the following information about its clients: • first name • last name • a user code assigned by your company. The information is stored in a file clients.txt with the information for each client on one line (last name first), with commas between the parts. In the clients.txt file is: Jones, Sally,00345 Lin,Nenya,00548 Fule,A,00000 Your job is to create a program assign usernames for a...

  • program language: python 3 Purpose: Solve a problem by writing multiple functions that perform different subtasks,...

    program language: python 3 Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem. Also to practice documenting functions. Degree of Difficulty: Moderate Your task is to compute the cost of renovating the flooring in a rectangular room. This includes replacing the carpet and and the baseboards. Your task is to write a Python program that calculates and the cost of the renovation. To accomplish this, you will need...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT