1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sergey [27]
3 years ago
14

Light travels at 3 × 108 meters per second. A light-year is the distance a light beam travels in one year.Write a PYTHON program

that calculates and displays the value of a light-year.Useful facts:Seconds in a year = 365×24×602Rate = 3×108meters per second
Computers and Technology
1 answer:
Volgvan3 years ago
4 0

Answer: This is a python code

def lightyear():

   rate=3*100000000   //speed of light

   seconds=365*24*60*60   //number of seconds in 1 year

   return str((rate*seconds)/1000)+" km"    //distance=speed x time

print(lightyear()) //will print value of light hear in kilometers

OUTPUT :

9460800000000.0 km

Explanation:

In the above code, there is a variable rate, which stores the speed of light, i.e. distance traveled by light in 1 second which is in meters. Another variable is seconds, which store the number of seconds in 1 year, which is no of days in 1 year multiplied by the number of hours in a day multiplied by the number of minutes in an hour multiplied by the number of seconds in a minute. Finally, distance is speed multiplied by time, so distance is printed in kilometers and to convert distance in kilometers it is divided by 1000.

You might be interested in
When might it be necessary or advisable to write a shell script instead of a shell function? give as many reasons as you can thi
Romashka-Z-Leto [24]

A shell function will do nothing unless it is explicitly called by other code, typically in a shell script. A shell script is a running executable process, which can call other shell scripts and/or functions. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.

3 0
3 years ago
What are the fundamental activities that are common to all software processes?
erica [24]

Answer:

There are some fundamental activities that are common to all software processes:

•Software specification. In this activity the functionality of the software and constraints on its operation must be defined.

•Software design and implementation. ...

•Software validation. ...

•Software evolution

7 0
3 years ago
Letter only ^_____^!
vagabundo [1.1K]

b serves as food for the yeast

4 0
3 years ago
Where did the name "QWERTY" come from?​
weqwewe [10]

Answer:

From the keyboard layout invented by Christopher Lathem Sholes. It is now the most used keyboard layout throughout the world

4 0
3 years ago
Hi I got a new phone and my photos are taking so long to download, on Friday it was at 13000 what do I do it’s taking so long
MariettaO [177]

Answer:

Try to use your mobile data but it might use up quite a bit. Also instead of downloading it transfer it to a laptop or a usb stick, or you can upload your photos to the cloud.

6 0
2 years ago
Other questions:
  • Using either a UNIX or a Linux system, write a C program that forks a child process that ultimately becomes a zombie process. Th
    8·1 answer
  • ServletConfig defines a set of methods that a servlet uses tocommunicate with its servlet container.
    5·1 answer
  • What piece of software tells the operating system how to use a specific hardware device? a. User interface b. System service c.
    14·1 answer
  • create a boolean variable called sucess that will be true if a number is between -10 and 10 inclusively python
    11·1 answer
  • Given a String variable named line1 and given a Scanner reference variable stdin that has been assigned a reference to a Scanner
    11·1 answer
  • You have created a new dhcp scope with address range 192.168.1.1 to 192.168.1.254. you have five servers configured with static
    9·1 answer
  • Generally speaking, problems are rarely caused by motherboards. However, there are some instances in which a motherboard can fai
    12·1 answer
  • Viết thuật toán, chương trình xử lý hạn chế trong việc xử lý số liệu phần nguyên để hiển thị lên lcd
    14·1 answer
  • If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
    12·1 answer
  • What is malware? a type of virus that spreads through a network connection a type of virus that targets programs and files any p
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!