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 = period1 / 60
minutes3 = period1 / 60
seconds1 = minutes1 % 60
seconds2 = minutes2 % 60
print('or', round(minutes1,1), 'minutes and', seconds, 'seconds on
Earth')
print(' ')
print('The period is', round(period2,3))
print('or', round(minutes2,1), 'minutes and', seconds, 'seconds on
Mars')
print(' ')
print('The period is', round(period3,3))
print('or', round(minutes3,1), 'minutes and', seconds, 'seconds on
Jupiter')
else:
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 = period2 // 60
minutes3 = period3 // 60
seconds1 = minutes1 % 60
seconds2 = minutes2 % 60
seconds3 = minutes3 % 60
print('or', round(minutes1,1), 'minutes and', seconds1, 'seconds on
Earth')
print(' ')
print('The period is', round(period2,3))
print('or', round(minutes2,1), 'minutes and', seconds2, 'seconds on
Mars')
print(' ')
print('The period is', round(period3,3))
print('or', round(minutes3,1), 'minutes and', seconds3, 'seconds on Jupiter')
main()
Okay so I need to convert seconds to seconds AND minutes. I am unsure of how to use % to get the seconds and minutes in an output. I need to use // and % in this. I am very new at this so I apologize if it is sloppy or overkill. The area that is messed up are the lines with % included. Thank you!