Created
April 30, 2020 13:28
-
-
Save Raj39120/f66e3dc271d9ac70a33da42e6e72415b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import functools | |
def sum_of_list_of_numbers(): | |
list_of_numbers = list() | |
print("How many numbers do you want to include in this list?") | |
list_count = int(input()) | |
for i in range(list_count): | |
list_of_numbers.append(int(input("Enter the number you want to add to the list: "))) | |
count = 0 | |
for y in list_of_numbers: | |
count = count + y | |
print("The sum of your list of numbers", count) | |
# make sure you enter more than one number | |
# make sure your numbers are real numbers | |
# make sure your numbers are formatted like x, y, z | |
# make sure you press enter when you finish entering your list of numbers | |
def sum_of_two_numbers(): | |
addend1 = float(input("Enter the first number that you want to add over here: ")) | |
print("The sum so far: ") | |
print(addend1) | |
addend2 = float(input("Enter the second number that you want to add over here: ")) | |
print("The sum so far: ") | |
print(addend1 + addend2) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def difference_of_two_numbers(): | |
minuend = float(input("Enter the first number that you want to subtract over here: ")) | |
subtrahend = float(input("Enter the second number that you want to subtract over here: ")) | |
print("The difference is below: ") | |
print(minuend - subtrahend) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def product_of_two_numbers(): | |
factor1 = float(input("Enter the first number that you want to multiply over here: ")) | |
factor2 = float(input("Enter the second number that you want to multiply over here: ")) | |
print("The product is below: ") | |
print(factor1 * factor2) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def quotient_of_two_numbers(): | |
dividend = float(input("Enter the first number that you want to divide over here: ")) | |
divisor = float(input("Enter the second number that you want to divide over here: ")) | |
print("The quotient is below: ") | |
print(dividend / divisor) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def circumference_of_circle_using_radius(): | |
radius = float(input("Enter the length of the radius here: ")) | |
if radius <= 0: | |
print("The radius can't be zero or negative") | |
return | |
print("The circumference of the circle in decimal form is below: ") | |
print(2.0 * math.pi * radius) | |
print("The circumference of the circle in terms of pi is below: ") | |
value_of_diameter = str(2.0 * radius) | |
pi = "pi" | |
print(value_of_diameter + pi) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def circumference_of_circle_using_diameter(): | |
diameter = float(input("Enter the length of the diameter here: ")) | |
if diameter <= 0: | |
print("The diameter can't be zero or negative") | |
return | |
print("The circumference of the circle in decimal form is below: ") | |
print(math.pi * diameter) | |
print("The circumference of the circle in terms of pi is below: ") | |
pi = "pi" | |
print(str(diameter) + pi) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_triangle(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The side length can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The side length can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The side length can't be zero or negative") | |
return | |
if side1 + side2 <= side3: | |
print("The side lengths don't satisfy the triangle inequality theorem") | |
return | |
if side2 + side3 <= side1: | |
print("The side lengths don't satisfy the triangle inequality theorem") | |
return | |
if side1 + side3 <= side2: | |
print("The side lengths don't satisfy the triangle inequality theorem") | |
return | |
print("The perimeter of the triangle is below: ") | |
print(side1 + side2 + side3) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_rectangle(): | |
length = float(input("Enter the length of the rectangle: ")) | |
if length <= 0: | |
print("The length can't be zero or negative") | |
return | |
width = float(input("Enter the width of the rectangle: ")) | |
if width <= 0: | |
print("The width can't be zero or negative") | |
return | |
print("The perimeter of the rectangle is below: ") | |
print(2.0 * (length + width)) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_square(): | |
side_length = float(input("Enter the side length of the square: ")) | |
if side_length <= 0: | |
print("The side length of the square can't be zero or negative") | |
return | |
print("The perimeter of the square is below: ") | |
print(side_length * 4.0) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_quadrilateral(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The length of side 1 can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The length of side 2 can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The length of side 3 can't be zero or negative") | |
return | |
side4 = float(input("Enter the length of side 4 here: ")) | |
if side4 <= 0: | |
print("The length of side 4 can't be zero or negative") | |
return | |
print("The perimeter of the quadrilateral is below: ") | |
print(side1 + side2 + side3 + side4) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_pentagon(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The length of side 1 can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The length of side 2 can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The length of side 3 can't be zero or negative") | |
return | |
side4 = float(input("Enter the length of side 4 here: ")) | |
if side4 <= 0: | |
print("The length of side 4 can't be zero or negative") | |
return | |
side5 = float(input("Enter the length of side 5 here: ")) | |
if side5 <= 0: | |
print("The length of side 5 can't be zero or negative") | |
return | |
print("The perimeter of the pentagon is below: ") | |
print(side1 + side2 + side3 + side4 + side5) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_hexagon(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The length of side 1 can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The length of side 2 can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The length of side 3 can't be zero or negative") | |
return | |
side4 = float(input("Enter the length of side 4 here: ")) | |
if side4 <= 0: | |
print("The length of side 4 can't be zero or negative") | |
return | |
side5 = float(input("Enter the length of side 5 here: ")) | |
if side5 <= 0: | |
print("The length of side 5 can't be zero or negative") | |
return | |
side6 = float(input("Enter the length of side 6 here: ")) | |
if side6 <= 0: | |
print("The length of side 6 can't be zero or negative") | |
return | |
print("The perimeter of the hexagon is below: ") | |
print(side1 + side2 + side3 + side4 + side5 + side6) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_heptagon(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The length of side 1 can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The length of side 2 can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The length of side 3 can't be zero or negative") | |
return | |
side4 = float(input("Enter the length of side 4 here: ")) | |
if side4 <= 0: | |
print("The length of side 4 can't be zero or negative") | |
return | |
side5 = float(input("Enter the length of side 5 here: ")) | |
if side5 <= 0: | |
print("The length of side 5 can't be zero or negative") | |
return | |
side6 = float(input("Enter the length of side 6 here: ")) | |
if side6 <= 0: | |
print("The length of side 6 can't be zero or negative") | |
return | |
side7 = float(input("Enter the length of side 7 here: ")) | |
if side7 <= 0: | |
print("The length of side 7 can't be zero or negative") | |
return | |
print("The perimeter of the heptagon is below: ") | |
print(side1 + side2 + side3 + side4 + side5 + side6 + side7) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_octagon(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The length of side 1 can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The length of side 2 can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The length of side 3 can't be zero or negative") | |
return | |
side4 = float(input("Enter the length of side 4 here: ")) | |
if side4 <= 0: | |
print("The length of side 4 can't be zero or negative") | |
return | |
side5 = float(input("Enter the length of side 5 here: ")) | |
if side5 <= 0: | |
print("The length of side 5 can't be zero or negative") | |
return | |
side6 = float(input("Enter the length of side 6 here: ")) | |
if side6 <= 0: | |
print("The length of side 6 can't be zero or negative") | |
return | |
side7 = float(input("Enter the length of side 7 here: ")) | |
if side7 <= 0: | |
print("The length of side 7 can't be zero or negative") | |
return | |
side8 = float(input("Enter the length of side 8 here: ")) | |
if side8 <= 0: | |
print("The length of side 8 can't be zero or negative") | |
return | |
print("The perimeter of the octagon is below: ") | |
print(side1 + side2 + side3 + side4 + side5 + side6 + side7 + side8) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_nonagon(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The length of side 1 can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The length of side 2 can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The length of side 3 can't be zero or negative") | |
return | |
side4 = float(input("Enter the length of side 4 here: ")) | |
if side4 <= 0: | |
print("The length of side 4 can't be zero or negative") | |
return | |
side5 = float(input("Enter the length of side 5 here: ")) | |
if side5 <= 0: | |
print("The length of side 5 can't be zero or negative") | |
return | |
side6 = float(input("Enter the length of side 6 here: ")) | |
if side6 <= 0: | |
print("The length of side 6 can't be zero or negative") | |
return | |
side7 = float(input("Enter the length of side 7 here: ")) | |
if side7 <= 0: | |
print("The length of side 7 can't be zero or negative") | |
return | |
side8 = float(input("Enter the length of side 8 here: ")) | |
if side8 <= 0: | |
print("The length of side 8 can't be zero or negative") | |
return | |
side9 = float(input("Enter the length of side 9 here: ")) | |
if side9 <= 0: | |
print("The length of side 9 can't be zero or negative") | |
return | |
print("The perimeter of the nonagon is below: ") | |
print(side1 + side2 + side3 + side4 + side5 + side6 + side7 + side8 + side9) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def perimeter_of_decagon(): | |
side1 = float(input("Enter the length of side 1 here: ")) | |
if side1 <= 0: | |
print("The length of side 1 can't be zero or negative") | |
return | |
side2 = float(input("Enter the length of side 2 here: ")) | |
if side2 <= 0: | |
print("The length of side 2 can't be zero or negative") | |
return | |
side3 = float(input("Enter the length of side 3 here: ")) | |
if side3 <= 0: | |
print("The length of side 3 can't be zero or negative") | |
return | |
side4 = float(input("Enter the length of side 4 here: ")) | |
if side4 <= 0: | |
print("The length of side 4 can't be zero or negative") | |
return | |
side5 = float(input("Enter the length of side 5 here: ")) | |
if side5 <= 0: | |
print("The length of side 5 can't be zero or negative") | |
return | |
side6 = float(input("Enter the length of side 6 here: ")) | |
if side6 <= 0: | |
print("The length of side 6 can't be zero or negative") | |
return | |
side7 = float(input("Enter the length of side 7 here: ")) | |
if side7 <= 0: | |
print("The length of side 7 can't be zero or negative") | |
return | |
side8 = float(input("Enter the length of side 8 here: ")) | |
if side8 <= 0: | |
print("The length of side 8 can't be zero or negative") | |
return | |
side9 = float(input("Enter the length of side 9 here: ")) | |
if side9 <= 0: | |
print("The length of side 9 can't be zero or negative") | |
return | |
side10 = float(input("Enter the length of side 10 here: ")) | |
if side10 <= 0: | |
print("The length of side 10 can't be zero or negative") | |
return | |
print("The perimeter of the decagon is below: ") | |
print(side1 + side2 + side3 + side4 + side5 + side6 + side7 + side8 + side9 + side10) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def area_of_circle_using_radius(): | |
radius = float(input("Enter the radius of the circle here: ")) | |
if radius <= 0: | |
print("The radius of the circle can't be zero or negative") | |
return | |
print("The area of the circle in decimal form is below: ") | |
print(math.pi * radius ** 2) | |
print("The area of the circle in terms of pi is below: ") | |
radius_squared = str(radius ** 2) | |
pi = "pi" | |
print(radius_squared + pi) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def area_of_circle_using_diameter(): | |
diameter = float(input("Enter the diameter of the circle here: ")) | |
if diameter <= 0: | |
print("The diameter can't be zero or negative") | |
return | |
print("The area of the circle in decimal form is below: ") | |
print(math.pi * ((diameter / 2.0) ** 2)) | |
print("The area of the circle in terms of pi is below: ") | |
coefficient = str((diameter / 2.0) ** 2) | |
pi = "pi" | |
print(coefficient + pi) | |
# make sure you enter real numbers | |
# make sure you enter even numbers | |
# make sure you press enter after entering your number | |
def area_of_right_angle_triangle(): | |
leg1 = float(input("Enter the length of the first leg of the triangle here: ")) | |
if leg1 <= 0: | |
print("The length of the first leg can't be zero or negative") | |
return | |
leg2 = float(input("Enter the length of the second leg of the triangle here: ")) | |
if leg2 <= 0: | |
print("The length of the second leg can't be zero or negative") | |
return | |
print("The area of the right triangle is below: ") | |
print((leg1 * leg2) / 2.0) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def area_of_trapezoid(): | |
long_side = float(input("Enter the length of the longer side here: ")) | |
if long_side <= 0: | |
print("The long side can't be zero or negative") | |
return | |
short_side = float(input("Enter the length of the shorter side here: ")) | |
if short_side <= 0: | |
print("The short side can't be zero or negative") | |
return | |
height = float(input("Enter the height of the trapezoid here: ")) | |
if height <= 0: | |
print("The height of the trapezoid can't be zero or negative") | |
return | |
print("The area of the trapezoid is below: ") | |
print(((long_side + short_side) / 2.0) * height) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def _use_deg(f, arc=False): | |
if not arc: | |
def df(*args): | |
args = list(args) | |
for index, value in enumerate(args): | |
try: | |
args[index] = math.radians(value) | |
except TypeError: | |
pass | |
return f(*args) | |
else: | |
def df(*args): | |
return math.degrees(f(*args)) | |
return functools.wraps(f)(df) | |
sind = _use_deg(math.sin) | |
cosd = _use_deg(math.cos) | |
tand = _use_deg(math.tan) | |
arcsind = _use_deg(math.asin, True) | |
arccosd = _use_deg(math.acos, True) | |
arctand = _use_deg(math.atan, True) | |
arctan2d = _use_deg(math.atan2, True) | |
def area_of_regular_polygon(): | |
number_of_sides = float(input("Enter the number of sides in the polygon here: ")) | |
if number_of_sides <= 0: | |
print("The number of sides can't be zero or negative") | |
return | |
length_of_each_side = float(input("Enter the side length here: ")) | |
if length_of_each_side <= 0: | |
print("The side length can't be zero or negative") | |
return | |
apothem = (length_of_each_side / (2.0 * (tand(180.0 / number_of_sides)))) | |
print(apothem) | |
print("The area of the polygon is below: ") | |
print(((number_of_sides * length_of_each_side) * apothem) / 2.0) | |
# make sure you enter real numbers | |
# make sure you enter an integer for the side length | |
# make sure you press enter after entering your number | |
def area_of_rectangle(): | |
length = float(input("Enter the length of the rectangle: ")) | |
if length <= 0: | |
print("The length can't be zero or negative") | |
return | |
width = float(input("Enter the width of the rectangle: ")) | |
if width <= 0: | |
print("The width can't be zero or negative") | |
return | |
print("The area of the rectangle is below: ") | |
print(length * width) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def area_of_rhombus(): | |
long_diagonal = float(input("Input the length of the longer diagonal here: ")) | |
if long_diagonal <= 0: | |
print("The length of the longer diagonal can't be zero or negative") | |
return | |
short_diagonal = float(input("Input the length of the shorter diagonal here: ")) | |
if short_diagonal <= 0: | |
print("The length of the short diagonal can't be zero or negative") | |
return | |
print("The area of the rhombus is below: ") | |
print((long_diagonal * short_diagonal) / 2.0) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def area_of_square(): | |
side_length = float(input("Enter the side length of the square here: ")) | |
if side_length <= 0: | |
print("The side length of the square can't be zero or negative") | |
return | |
print("The area of the square is below: ") | |
print(side_length ** 2) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def volume_of_right_rectangular_prism(): | |
length = float(input("Enter the length of the rectangular prism here: ")) | |
if length <= 0: | |
print("The length of the right rectangular prism can't be zero or negative") | |
return | |
width = float(input("Enter the width of the rectangular prism here: ")) | |
if width <= 0: | |
print("The width of the right rectangular prism can't be zero or negative") | |
return | |
height = float(input("Enter the width of the rectangular prism here: ")) | |
if height <= 0: | |
print("The height of the right rectangular prism can't be zero or negative") | |
return | |
print("The volume of the rectangular prism is below: ") | |
print(length * width * height) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def volume_of_triangular_pyramid_using_side_length_of_base(): | |
base_length = float(input("Enter the base length of the base triangle of the triangular pyramid here: ")) | |
if base_length <= 0: | |
print("The side length of the base of the base triangle of the triangular pyramid can't be zero or negative") | |
return | |
base_triangle_2 = float(input("Enter the height of the base triangle of the triangular pyramid here: ")) | |
if base_triangle_2 <= 0: | |
print("The height of the base triangle of the triangular pyramid can't be zero or negative") | |
return | |
height = float(input("Enter the height of the triangular pyramid here: ")) | |
if height <= 0: | |
print("The height of the triangular pyramid can't be zero or negative") | |
return | |
print("The volume of the triangular pyramid is below: ") | |
print(((base_length * base_triangle_2 / 2.0) * height) / 3.0) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def volume_of_square_pyramid(): | |
side_length_of_base = float(input("Enter the side length of the base of the pyramid here: ")) | |
if side_length_of_base <= 0: | |
print("The side length of the base of the pyramid can't be zero or negative") | |
return | |
pyramid_height = float(input("Enter the height of the pyramid here: ")) | |
if pyramid_height <= 0: | |
print("The height of the pyramid can't be zero or negative") | |
return | |
print("The volume of the square pyramid is below: ") | |
print((1.0 / 3.0) * (side_length_of_base ** 2) * pyramid_height) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def volume_of_right_rectangular_pyramid(): | |
length_of_base = float(input("Enter the length of the base of the right rectangular pyramid here: ")) | |
if length_of_base <= 0: | |
print("The length of the base of the right rectangular pyramid can't be zero or negative") | |
return | |
width_of_base = float(input("Enter the width of the base of the right rectangular pyramid here: ")) | |
if width_of_base <= 0: | |
print("The width of the base of the right rectangular pyramid can't be zero or negative") | |
return | |
height_of_right_rectangular_pyramid = float(input("Enter the height of the right rectangular pyramid here: ")) | |
if height_of_right_rectangular_pyramid <= 0: | |
print("The height of the right rectangular pyramid can't be zero or negative") | |
return | |
print("The volume of the right rectangular pyramid is below: ") | |
print((length_of_base * width_of_base * height_of_right_rectangular_pyramid) / 3.0) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def volume_of_cylinder(): | |
radius_of_base = float(input("Enter the radius of the base here: ")) | |
if radius_of_base <= 0: | |
print("The radius of the base of the cylinder can't be zero ro negative") | |
return | |
height_of_cylinder = float(input("Enter the height of the cylinder here: ")) | |
if height_of_cylinder <= 0: | |
print("The height of the cylinder can't be zero or negative") | |
return | |
print("The volume of the cylinder in decimal form is below: ") | |
print((math.pi * (radius_of_base ** 2)) * height_of_cylinder) | |
print("The volume of the cylinder in terms of pi is below: ") | |
coefficient = str((radius_of_base ** 2) * height_of_cylinder) | |
pi = "pi" | |
print(coefficient + pi) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def volume_of_sphere(): | |
radius = float(input("Enter the radius of the sphere here: ")) | |
if radius <= 0: | |
print("The radius of the sphere can't be zero or negative") | |
return | |
print("The volume of the sphere in decimal form is below: ") | |
print((4.0 / 3.0) * math.pi * (radius ** 3)) | |
print("The volume of the sphere in terms of pi is below: ") | |
coefficient = str((4.0 / 3.0) * math.pi * (radius ** 3)) | |
pi = "pi" | |
print(coefficient + pi) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def volume_of_cube(): | |
side_length = float(input("Enter the length of the cube here: ")) | |
if side_length <= 0: | |
print("The side length of the cube can't be zero or negative") | |
return | |
print("The volume of the cube is below: ") | |
print(side_length ** 3) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def surface_area_of_cube(): | |
side_length = float(input("Enter the side length of the cube here: ")) | |
if side_length <= 0: | |
print("The side length of the cube can't be zero or negative") | |
return | |
print("The surface area of the cube is below: ") | |
print((side_length ** 2) * 6.0) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def surface_area_of_rectangular_prism(): | |
length = float(input("Enter the length of the rectangular prism here: ")) | |
if length <= 0: | |
print("The length of the rectangular prism can't be zero or negative") | |
return | |
width = float(input("Enter the width of the rectangular prism here: ")) | |
if width <= 0: | |
print("The width of the rectangular prism can't be zero or negative") | |
return | |
height = float(input("Enter the height of the rectangular prism here: ")) | |
if height <= 0: | |
print("The height of the rectangular prism can't be zero or negative") | |
return | |
print("The surface area of the rectangular prism is below: ") | |
print(2.0 * ((length * width) + (width * height) + (height * length))) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def surface_area_of_cylinder(): | |
radius = float(input("Enter the radius of the base of the cylinder here: ")) | |
if radius <= 0: | |
print("The radius of the cylinder can't be zero or negative") | |
return | |
height = float(input("Enter the height of the cylinder here: ")) | |
if height <= 0: | |
print("The height of the cylinder can't be zero or negative") | |
return | |
print("The surface area of the cylinder in decimal form is below: ") | |
print((2.0 * math.pi * radius) * (radius + height)) | |
print("The surface are of the cylinder in terms of pi is below: ") | |
coefficient = str(((2.0 * radius) * (radius + height))) | |
pi = "pi" | |
print(coefficient + pi) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def surface_area_of_sphere(): | |
radius = float(input("Enter the radius of the sphere here: ")) | |
if radius <= 0: | |
print("The radius of the sphere can't be zero or negative") | |
return | |
print("The surface area of the sphere in decimal form is below: ") | |
print(4.0 * math.pi * (radius ** 2.0)) | |
print("The surface area of the sphere in terms of pi is below: ") | |
coefficient = str(4.0 * (radius ** 2)) | |
pi = "pi" | |
print(coefficient + pi) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
def missing_angle_of_triangle(): | |
angle1 = float(input("Enter the first angle of the triangle here: ")) | |
if angle1 <= 0: | |
print("The first angle can't be zero ro negative") | |
return | |
if angle1 >= 180: | |
print("The first angle can't be greater than or equal to 180") | |
return | |
angle2 = float(input("Enter the second angle of the triangle here: ")) | |
if angle2 <= 0: | |
print("The second angle can't be zero or negative") | |
return | |
if (angle1 + angle2) >= 180: | |
print("The first two angles can't be greater than or equal to 180") | |
return | |
print("The third angle of the triangle is below: ") | |
print(180 - (angle1 + angle2)) | |
# make sure you enter real numbers | |
# make sure you press enter after entering your number | |
from Math_Formulas import * | |
import time | |
print("This is a math calculator with 37 different topics you can choose from.") | |
time.sleep(3.0) | |
print("Below, there is a list of the 37 topics, each with its own corresponding number.") | |
time.sleep(3.0) | |
print("Enter the number of the topic you want to do at the end.") | |
time.sleep(3.0) | |
print("1 = Sum of list of numbers") | |
time.sleep(1.0) | |
print("2 = Sum of two numbers") | |
time.sleep(1.0) | |
print("3 = Difference of two numbers") | |
time.sleep(1.0) | |
print("4 = Product of two numbers") | |
time.sleep(1.0) | |
print("5 = Quotient of two numbers") | |
time.sleep(1.0) | |
print("6 = Circumference of circle using radius") | |
time.sleep(1.0) | |
print("7 = Circumference of circle using diameter") | |
time.sleep(1.0) | |
print("8 = Perimeter of triangle") | |
time.sleep(1.0) | |
print("9 = Perimeter of rectangle") | |
time.sleep(1.0) | |
print("10 = Perimeter of square") | |
time.sleep(1.0) | |
print("11 = Perimeter of quadrilateral") | |
time.sleep(1.0) | |
print("12 = Perimeter of pentagon") | |
time.sleep(1.0) | |
print("13 = Perimeter of hexagon") | |
time.sleep(1.0) | |
print("14 = Perimeter of heptagon") | |
time.sleep(1.0) | |
print("15 = Perimeter of octagon") | |
time.sleep(1.0) | |
print("16 = Perimeter of nonagon") | |
time.sleep(1.0) | |
print("17 = Perimeter of decagon") | |
time.sleep(1.0) | |
print("18 = Area of circle using radius") | |
time.sleep(1.0) | |
print("19 = Area of circle using diameter") | |
time.sleep(1.0) | |
print("20 = Area of right angle triangle") | |
time.sleep(1.0) | |
print("21 = Area of trapezoid") | |
time.sleep(1.0) | |
print("22 = Area of regular polygon") | |
time.sleep(1.0) | |
print("23 = Area of rectangle") | |
time.sleep(1.0) | |
print("24 = Area of rhombus") | |
time.sleep(1.0) | |
print("25 = Area of square") | |
time.sleep(1.0) | |
print("26 = Volume of right rectangular prism") | |
time.sleep(1.0) | |
print("27 = Volume of triangular pyramid using side length of base") | |
time.sleep(1.0) | |
print("28 = Volume of square pyramid") | |
time.sleep(1.0) | |
print("29 = Volume of right rectangular pyramid") | |
time.sleep(1.0) | |
print("30 = Volume of cylinder") | |
time.sleep(1.0) | |
print("31 = Volume of sphere") | |
time.sleep(1.0) | |
print("32 = Volume of cube") | |
time.sleep(1.0) | |
print("33 = Surface area of cube") | |
time.sleep(1.0) | |
print("34 = Surface area of rectangular prism") | |
time.sleep(1.0) | |
print("35 = Surface area of cylinder") | |
time.sleep(1.0) | |
print("36 = Surface area of sphere") | |
time.sleep(1.0) | |
print("37 = Missing angle of triangle") | |
time.sleep(1.0) | |
choice = int(input("Enter your choice: ")) | |
if choice == 1: | |
sum_of_list_of_numbers() | |
elif choice == 2: | |
sum_of_two_numbers() | |
elif choice == 3: | |
difference_of_two_numbers() | |
elif choice == 4: | |
product_of_two_numbers() | |
elif choice == 5: | |
quotient_of_two_numbers() | |
elif choice == 6: | |
circumference_of_circle_using_radius() | |
elif choice == 7: | |
circumference_of_circle_using_diameter() | |
elif choice == 8: | |
perimeter_of_triangle() | |
elif choice == 9: | |
perimeter_of_rectangle() | |
elif choice == 10: | |
perimeter_of_square() | |
elif choice == 11: | |
perimeter_of_quadrilateral() | |
elif choice == 12: | |
perimeter_of_pentagon() | |
elif choice == 13: | |
perimeter_of_hexagon() | |
elif choice == 14: | |
perimeter_of_heptagon() | |
elif choice == 15: | |
perimeter_of_octagon() | |
elif choice == 16: | |
perimeter_of_nonagon() | |
elif choice == 17: | |
perimeter_of_decagon() | |
elif choice == 18: | |
area_of_circle_using_radius() | |
elif choice == 19: | |
area_of_circle_using_diameter() | |
elif choice == 20: | |
area_of_right_angle_triangle() | |
elif choice == 21: | |
area_of_trapezoid() | |
elif choice == 22: | |
area_of_regular_polygon() | |
elif choice == 23: | |
area_of_rectangle() | |
elif choice == 24: | |
area_of_rhombus() | |
elif choice == 25: | |
area_of_square() | |
elif choice == 26: | |
volume_of_right_rectangular_prism() | |
elif choice == 27: | |
volume_of_triangular_pyramid_using_side_length_of_base() | |
elif choice == 28: | |
volume_of_square_pyramid() | |
elif choice == 29: | |
volume_of_right_rectangular_pyramid() | |
elif choice == 30: | |
volume_of_cylinder() | |
elif choice == 31: | |
volume_of_sphere() | |
elif choice == 32: | |
volume_of_cube() | |
elif choice == 33: | |
surface_area_of_cube() | |
elif choice == 34: | |
surface_area_of_rectangular_prism() | |
elif choice == 35: | |
surface_area_of_cylinder() | |
elif choice == 36: | |
surface_area_of_sphere() | |
elif choice == 37: | |
missing_angle_of_triangle() | |
else: | |
print("Please enter valid choice.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment