Very new programmer here! Can someone please help me understand what's happening with my python code?
def Validate_Integer_Input(prompt):
global strFlag
global value
while strFlag is False:
try:
value = int(input(prompt))
except ValueError:
print("Input must be numeric.")
continue
if value < 0:
print("Integer must be positive. ")
continue
else:
strFlag = True
return value
def Calculate_Sphere_Volume(intDiameter):
dblVolume = float(0)
dblRadius = float(0)
global strFlag
strFlag = bool(False)
intDiameter = Validate_Integer_Input("Please enter diameter of sphere: ")
dblRadius = float(intDiameter / 2)
import math
dblVolume = (4/3 * math.pi * (dblRadius**3))
print("The volume of a sphere with a diameter of ", intDiameter, " has a volume of", dblVolume)
When I run the code in Visual Studio, it is working perfectly, printing out the correct volume. When I run the program on the Windows terminal, after I enter the diameter the terminal just disappears. Can someone help me understand why this is happening??! Much appreciated!!
(Main code just calls the Calculate_Sphere_Volume function)