Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using python Program Three: Planetary Years In Program 1, you converted from years on Mars to years on Earth. We now want to consider other

using python
image text in transcribed
Program Three: Planetary Years In Program 1, you converted from years on Mars to years on Earth. We now want to consider other planets, and figure out what your age would be on other planets, using their definition of a year. For our purposes, a 'year' is the time it takes for a particular planet to orbit the sun (a revolution). The table below shows how long a year lasts on other planets in terms of Earth days: In the file, convert_age.py, you have been given two lines of code that you cannot change in any way which must be used for your program. Your task is to complete the remainder of the program so that it meets the specifications explained below. Your program will allow the user to input their age on a home planet and then converts their age to the selected destination planct. The program will provide the output in the requested format. The program will take three inputs: a number for selecting home planet, age on home planet and a number to select the destination planet. For consistency, format the program's interaction as illustrated in the following examples. Do not vary the phrasing, capitalization, spacing, etc. Select your home planet: 1 for Mercury, 2 for Mars, 3 for Jupiter, 4 for Saturn, 5 for Neptune: 1 Enter your age on your home planet: 10 Select a destination planet: 1 for Mercury, 2 for Mars, 3 for Jupiter, 4 for Saturn, 5 for Neptune: 2 Your age on Mars is about 1 years Your well-styled program should be submitted in a file called convert_age.py (the same name as the template file given to you). You can assume that the inputs for age will always be positive numbers, but they may have fractional components. You can also assume that the inputs for selecting a planet will always be one of the integers 1,2,3,4, or 5 . The final value computed should be an integer. No other inputs will be tested. N.B.: (1) you must only use programming structures discussed so far - this means no conditionals and no imported mathematical functions/modules and no object types that we have not discussed yet. You don't need them here, (2) You are not permitted to edit the code given in any way - you must use the list provided as is. This means not taking the values out and making a new list with different values in it, not assigning each item in the list a single variable and using that, not creating your own list with the same name to use, etc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions