Question

In: Computer Science

Problem: Write a program that takes your weight in pounds as input and then prints how...

Problem: Write a program that takes your weight in pounds as input and then prints how much you will weigh on Moon and Mars. The formula to convert weight on the Earth to weight on Moon and Mars are given below:

  • Weight on Moon = weight on Earth * 0.165
  • Weight on Mars = weight on Earth * 3.711 / 9.81

You should name the program as weight_watcher.py. The output should look like as shown below:

Solutions

Expert Solution

'''
Python version : 3.6
Python program that takes your weight in pounds as input
and then prints how much you will weigh on Moon and Mars.
'''

# input the weight in pounds on Earth
earth_weight = float(input('Enter the weight (in pounds) on Earth: '))

# calculate the weight on Moon
moon_weight = earth_weight*0.165
# calculate the weight on Mars
mars_weight = (earth_weight*3.711)/9.81

# display the weights on Earth, Mars and Moon
print('Weight on Earth: %.2f pounds' %(earth_weight))
print('Weight on Moon: %.2f pounds' %(moon_weight))
print('Weight on Mars: %.2f pounds' %(mars_weight))

#end of program

Code Screenshot:

Output:


Related Solutions

Text Wrap Problem Write a program in Python that takes an input string and prints it...
Text Wrap Problem Write a program in Python that takes an input string and prints it as multiple lines of text such that no line of text is greater than 13 characters and words are kept whole. For example, the first line of the Gettysburg address: Four score and seven years ago our fathers brought forth upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal Becomes: Four score and...
5. Write a CH program that takes the marks of a student as input and prints...
5. Write a CH program that takes the marks of a student as input and prints the grade on screen according to the following criteria: CRITERIA LESS THAN 60 GREATER THAN 60 BUT LESS THAN 65 GREATER THAN 65 BUT LESS THAN 70 GREATER THAN 70 BUT LESS THAN 75 GREATER THAN 75 BUT LESS THAN 80 GREATER THAN 80 BUT LESS THAN 85 GREATER THAN 85 BUT LESS THAN 90 GREATER THAN 90 GRADE F D D+ с C+...
Write a program in C that takes as input an 8-bit binary number and prints the...
Write a program in C that takes as input an 8-bit binary number and prints the next 10 binary numbers. Define a binary number as int binNum[8]; Use binNum[0] to store the most significant (i.e., leftmost) bit and binNum[7] to store the least significant bit. Ask the user to input the first binary number with each bit separated by at least one space.
Write a program in C that takes as input a four-digit hexadecimal number and prints the...
Write a program in C that takes as input a four-digit hexadecimal number and prints the next 10 hexadecimal numbers. Define a hexadecimal number as int hexNum[4] Allow upper- or lowercase letters for input and use uppercase letters for the hexadecimal output. For example, 3C6f should be valid input and should produce output 3C6F, 3C70, 3C71, . . . .
C Program: Create a C program that prints a menu and takes user choices as input....
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output. Important! Consider which control structures will work best for which aspect of the assignment. For example, which would be the best to use for a menu?...
C Program: Create a C program that prints a menu and takes user choices as input....
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output. Your code must contain at least one of all of the following control types: nested for() loops a while() or a do-while() loop a switch() statement...
In a language of your own choosing, write a computer program that takes as input a...
In a language of your own choosing, write a computer program that takes as input a decimal (base 10) floating point number, and converts this number into a binary floating-point representation. The binary floating-point representation should consist of 1 bit for the sign of the significand; 8 bits for the biased exponent; and 23 bits for the significand. In addition to program source code, provide a screenshot showing the tasks identified below. Provide an output that shows your input decimal...
Write a Java program that takes in a string and a number and prints back the...
Write a Java program that takes in a string and a number and prints back the string from the number repeatedly until the first character... for example Pasadena and 4 will print PasaPasPaP. Ask the user for the string and a number Print back the string from the number repeatedly until the first character For both programs please utilize: methods arrays loops Turn in screenshots
Write a Python function that takes as input parameters base_cost (a float) and customer_type and prints...
Write a Python function that takes as input parameters base_cost (a float) and customer_type and prints a message with information about the total amount owed and how much the tip was. As a reminder, the tip amounts are 10%, 15% and 20% for stingy, regular, and generous customers. And the tax amount should be 7%. The total amount is calculated as the sum of two amounts: check_amount = base_cost*1.07 tip_amount = tip_percentage*check_amount To receive full credit, you must use string...
Write a program that takes a date as input and outputs the date's season. The input...
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June 20 Summer:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT