-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweightonplanets.py
More file actions
33 lines (30 loc) · 1.46 KB
/
weightonplanets.py
File metadata and controls
33 lines (30 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#Author Mark Dymmek
#Date: 2/14/2025
#Purpose: Create python program to calcuate weight on other planets
#Constants
PLANET_MERCURY=0.38
PLANET_VENUS=0.91
PLANET_MOON=0.165
PLANET_MARS=0.38
PLANET_JUPITER=2.34
PLANET_SATURN=0.93
PLANET_URANUS=0.92
PLANET_NEPTUNE=1.12
PLANET_PLUTO=0.066
NUMBER_FORMAT="10,.2f"
MAX_STRING="35s"
#ask your name your weight then display your weight on other planets
sName = input("What is your name?: ")
fWeight = float(input(f"Hello {sName} How much do you weigh?: "))
#calculation
print(f"{sName} here is how much you weigh on the different planets")
print(f"{'Your weight on Mercury:':{MAX_STRING}} {PLANET_MERCURY * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Venus:':{MAX_STRING}} {PLANET_VENUS * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Moon:':{MAX_STRING}} {PLANET_MOON * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Mars:':{MAX_STRING}} {PLANET_MARS * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Jupiter:':{MAX_STRING}} {PLANET_JUPITER * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Saturn:':{MAX_STRING}} {PLANET_SATURN * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Uranus:':{MAX_STRING}} {PLANET_URANUS * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Neptune:':{MAX_STRING}} {PLANET_NEPTUNE * fWeight:{NUMBER_FORMAT}}")
print(f"{'Your weight on Pluto:':{MAX_STRING}} {PLANET_PLUTO * fWeight:{NUMBER_FORMAT}}")
#Prof C. I don't mind if you want to show my code that you tell people who wrote it