Question

In: Computer Science

A light year is the distance light travels in 1 year. Light travels at 3*108 meters*...

A light year is the distance light travels in 1 year.

Light travels at 3*108 meters* sec-1.

Write a program that calculates and displays the number of meters light travels in a year.

Solutions

Expert Solution

Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. 

Let me know for any help with any other questions.

Thank You!
===========================================================================

c = 3 * 10 ** 8 # speed of light

seconds_in_year = 365 * 24 * 60 * 60 # total seconds in a year

distance = c * seconds_in_year    # distance = speed* time 

print('Light travels {:,} meters in a year.'.format(distance))

================================================================


Related Solutions

comments please Your program will calculate the distance an object travels (in meters) on Earth for...
comments please Your program will calculate the distance an object travels (in meters) on Earth for a specified number of seconds. You will also calculate the distance traveled on the Moon (in meters) for the specified number of seconds. Your program must have the main function and, at least, the following four additional functions. The signatures for these functions must be as follows: double readSeconds() double calculateEarthDistance(double seconds) double calculateMoonDistance(double seconds) void displayResults(double seconds, double earthDistance, double moonDistance) The readSeconds...
The speed of light 3 × 108 m / s, can be expressed in terms of...
The speed of light 3 × 108 m / s, can be expressed in terms of other fundamental constants relating to electricity and magnetism. Give this algebraic expression and briefly explain where it comes from.
During a test a rocket travels upward at 75 meters/second, and when it is 40 meters...
During a test a rocket travels upward at 75 meters/second, and when it is 40 meters from the ground its engine fails. Determine the maximum height h reached by the rocket and its speed just before it hits the ground. While in motion the rocket is subjected to a constant downward acceleration of 9.81 m/s2 due to gravity. Neglect the effect of air resistance.
The distance a vehicle travels can be calculated as follows: Distance = Speed * Time For...
The distance a vehicle travels can be calculated as follows: Distance = Speed * Time For example, if a train travels 40 miles-per-hour for three hours, the distance traveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number of hours it has traveled. Both values are assumed to be integers. It should use a loop to display the distance a vehicle has traveled for each hour of a time period...
A car travels a certain distance along a straight road (in the +x direction). The distance...
A car travels a certain distance along a straight road (in the +x direction). The distance the car travels as a function of time is shown in the figure below. When the car changes speed it does so uniformly. Select the appropriate choice for each statement. It wont let me post the photo of the graph for some reason, so here is a link to it https://d2vlcm61l7u1fs.cloudfront.net/media%2Fa8f%2Fa8f89426-1896-44e8-863a-df989e927825%2FphpeLSO6i.png The acceleration magnitude at 15 sec is ..... the acceleration magnitude at 37...
A rectangular room is 12 meters long, 6 meters wide, and 3 meters high. 1] Calculate...
A rectangular room is 12 meters long, 6 meters wide, and 3 meters high. 1] Calculate the first three axial modes for the length of the room.   2] Find the wavelength, then convert to frequencies, assuming that the speed of sound in the room is 343 m/s. 3] Calculate the first 3 axial modes [Wavelenghts and frequencies] for the width of the room. 4] Calculate the first axial modes [Wavelenghts and frequencies] for the height of the room. It is...
1. Suppose it is claimed that the typical adult travels an average distance of 16 miles...
1. Suppose it is claimed that the typical adult travels an average distance of 16 miles to get to work each day. You believe this average is too low for Columbus residents. You survey a random sample of 98adults from Columbus and find that your sample travels an average distance of 17.6 miles to work each day, with a sample standard deviation of 7.8 miles.   Use this information to conduct the appropriate hypothesis test by going through the steps you...
PROGRAM IN C++ The distance a vehicle travels can be calculated using the following equation: distance...
PROGRAM IN C++ The distance a vehicle travels can be calculated using the following equation: distance = speed * time For example, if a train travels 40 miles per hour for 3 hours, the distance traveled is 120 miles. Write a program that asks the user for the speed of a vehicle (in miles per hour) and how many hours it has traveled. The program should then use a loop to display the distance the vehicle has traveled for each...
The Venus-Sun distance is 108 million kilometers, and the Earth-Sun distance is 150 million kilometers. Suppose...
The Venus-Sun distance is 108 million kilometers, and the Earth-Sun distance is 150 million kilometers. Suppose an imaginary line from Venus to the Sun forms a right angle with an imaginary line from Earth to the Sun. How long would it take light to travel from the Sun to a spaceship halfway along the straight-line path between Venus and Earth? The time is in minutes.
Which of the following is/are true about light? (i) In the ray approximation, light travels in...
Which of the following is/are true about light? (i) In the ray approximation, light travels in a straight line unless it encounters an obstacle or new medium. (ii) Light's electric field oscillates in a direction perpendicular to its direction of travel. (iii) Light's magnetic field oscillates in a direction parallel to its direction of travel. Please show all work including how you planned for the problem, did the problem, and a potential way to check! Thank you so much!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT