diff --git a/AreaCalc/AreaCalc.py b/AreaCalc/AreaCalc.py index 2899bca..fd22775 100644 --- a/AreaCalc/AreaCalc.py +++ b/AreaCalc/AreaCalc.py @@ -16,92 +16,95 @@ print('''Which Area/Volume Are You Calculating calcOpti = int(input('Choose An Option For The List Above: ')) -if calcOpti == 1: +if calcOpti == 0: # If calcOpti is 0 then quit. + exit() + +if calcOpti == 1: # Calculating the area of a square. print('\nYou have chosen the option: Square') SideA = float(input('How Wide is side A: ')) SideB = float(input('How Wide is side B: ')) sAxsB = SideA * SideB - print(f'The Square Area is: {sAxsB:.3f}') + print(f'The Square Area is: {sAxsB:.6f}') -if calcOpti == 2: +if calcOpti == 2: # Calculating the volume of a cube. print('\nYou have chosen the option: Cube') SideA = float(input('How Wide is side A: ')) SideB = float(input('How Wide is side B: ')) SideC = float(input('How Wide is side C: ')) sAxsBxsC = SideA * SideB * SideC - print(f'The Cube Volume is: {sAxsBxsC:.3f}') + print(f'The Cube Volume is: {sAxsBxsC:.6f}') -if calcOpti == 3: +if calcOpti == 3: # Calculating the volume of a pyramid. print('\nYou have chosen the option: Pyramid') SideA = float(input('How Wide is side A: ')) SideB = float(input('How Wide is side B: ')) Height = float(input('How High is it: ')) sAxsBxsH = SideA * SideB * Height / 3 - print(f'The Pyramid Volume is: {sAxsBxsH:.3f}') + print(f'The Pyramid Volume is: {sAxsBxsH:.6f}') -if calcOpti == 4: +if calcOpti == 4: # Calculating the area of a circle. print('\nYou have chosen the option: Circle') Radius = float(input('How Wide is Radius: ')) preArea = Radius * Radius - prePi = 3.14159265359 * preArea - print('The Circle Area is: ', prePi) + prePi = math.pi * preArea + print(f'The Circle Area is: {prePi:.6f}') -if calcOpti == 5: +if calcOpti == 5: # Calculating the arch length of a circle. print('\nYou have chosen the option: Arch Length') Angle = float(input('What is the angle(°): ')) Radius = float(input('What is the Radius: ')) a = Angle r = Radius - Answer = a / 360 * 3.14159265359 * 2 * r - print('The arch length is: ', Answer) + Answer = a / 360 * math.pi * 2 * r + print(f'The arch length is: {Answer:.6f}') -if calcOpti == 6: +if calcOpti == 6: # Calculating the area of a circle section. print('\nYou have chosen the option: Circle Section') Angle = float(input('What is the angle(°): ')) Radius = float(input('What is the Radius: ')) a = Angle r = Radius - Answer = a / 360 * 3.14159265359 * r * r - print('The Circle Section area is: ', Answer) + Answer = a / 360 * math.pi * r * r + print(f'The Circle Section area is: {Answer:.6f}') -if calcOpti == 7: +if calcOpti == 7: # Calculating the volume of a cylinder. print('\nYou have chosen the option: Cylinder') Radius = float(input('How Wide is Radius: ')) Height = float(input('How High is it: ')) preArea = Radius * Radius - prePi = 3.14159265359 * preArea + prePi = math.pi * preArea preCyl = prePi * Height - print('The Cylinder Volume is: ', preCyl) + print(f'The Cylinder Volume is: {preCyl:.6f}') -if calcOpti == 8: +if calcOpti == 8: # Calculating the volume of a cone. print('\nYou have chosen the option: Cone') Radius = float(input('How Wide is Radius: ')) Height = float(input('How High is it: ')) preArea = Radius * Radius - prePi = 3.14159265359 * preArea + prePi = math.pi * preArea preCyl = prePi * Height / 3 - print('The Cone Volume is: ', preCyl) + print(f'The Cone Volume is: {preCyl:.6f}') -if calcOpti == 9: +if calcOpti == 9: # Calculating the volume of a sphere. print('\nYou have chosen the option: Sphere') Radius = float(input('How Wide is Radius: ')) r = Radius prePi = r * r * r - pre4 = prePi * 3.14159265359 + pre4 = prePi * math.pi preD3 = pre4 * 4 Answer = preD3 / 3 - print('The Sphere Volume is: ', Answer) + print(f'The Sphere Volume is: {Answer:.6f}') -if calcOpti == 10: +if calcOpti == 10: # Calculating the area of a triangle print('\nYou have chosen the option: Triangle') print('Base = Any one of the three sides.') Base = float(input('How Wide is Base: ')) print('\nHeight = The distance between the base\nand the corner opposite the Base') Height = float(input('How high is the heigth: ')) Answer = Base * Height / 2 - print('The Triangle Area is: ',Answer ) + print(f'The Triangle Area is: {Answer:.6f}') -if calcOpti == 11: +if calcOpti == 11: # Calculating the volume of a prism. print('\nYou have chosen the option: Prism') print('Base = Any one of the three sides.') Base = float(input('How Wide is Base: ')) @@ -109,7 +112,4 @@ if calcOpti == 11: print('\nHeight = The distance between the base\nand the corner opposite the Base') Length = float(input('How long is the Prism: ')) Answer = Base * Height / 2 * Length - print('The Prism Volume is: ',Answer ) - -if calcOpti == 0: - exit() \ No newline at end of file + print(f'The Prism Volume is: {Answer:.6f}') \ No newline at end of file