def main():
import math
print('Period of a pendulum')
Earth_gravity = 9.8
Mars_gravity = 3.7263
Jupiter_gravity = 23.12
print(' ')
pen = float(input('How long is the pendulum (m)? '))
if pen < 0:
print('illegal length, length set to 1')
pen = 1
period1 = (2 * 3.14159265359) * math.sqrt(pen / Earth_gravity)
period2 = (2 * 3.14159265359) * math.sqrt(pen / Mars_gravity)
period3 = (2 * 3.14159265359) * math.sqrt(pen / Jupiter_gravity)
print(' ')
print('The period is', round(period1,3))
minutes1 = period1 / 60
minutes2 …Run Code Online (Sandbox Code Playgroud) python ×1