Introduction: Python - Schwarzschild Radius

About: Occupation: tech support
print ("This program will calculate the Schwarzschild Radius.")

# import the math module for the pow() function
import math

#  Schwarzschild Radius Forumula is: radius = [(2 * G * M)/(c**2)]
#  G is a constant: 6.67 * 10**-11
#  c is the speed of light: 3 * 10**8
#  M = mass of the object 

#  Function to solve for radius
#    Solve for r: enter m (Mass of object) 
#    (G is a constant; 6.67 * 10**-11)
#    (c is constant; 3 * 10**8
#    Formula: r = [(2 * G * M)/(c**2)]
#   User can enter mass exponential notation
def solveForRadius():
    print ("Solving for Radius")
    print ("Please enter the mass in exponential notation: ")
    massBase = int(input("Please enter the base: ") )
    massExponent = int(input("Please enter the exponent: ") )
    massWholeNumber = int(input("Please enter the whole number: ") )
    massBaseToPower = math.pow(massBase,massExponent)
    mass = massWholeNumber * massBaseToPower
    
    # G is a constant
    g =  (6.67 * (10**-11) )
    # c is a constant
    c = 3 * (10**8)
    # radius = [(2 * G * M)/(c**2)]
    radius =  (2* g * mass)/(c**2)
    print("The radius is:", radius, "km")
    
continueCalculations = "y"

# Check to see if the user wants to continue to calculate Schwarzschild Radius
while (continueCalculations=="y"):
    solveForRadius()
    continueCalculations = input("Would like to do another calculation for the Schwarzschild Radius? (y/n): ")
    
print("==================================")
print ("Thank you to Professor Morgan at the University of Northern Iowa for the formula and explanation.")