Oct-12-2017, 10:51 PM
(This post was last modified: Oct-12-2017, 10:52 PM by jwhenson1990.)

This is where I am trying to import the module. Having issues and have tried multiple things.

import geometry # my custom input module

rectWidth = ('Enter the Width of rectangle:')

rectLength = ('Enter the length of rectangle:')

radius = ('Enter the radius of circle:')

triangleHeight = ('Enter the Height of triangle:')

triangleBase = ('Enter the Base of triangle:')

xOne = ('Enter the point of X one:')

xTwo = ('Enter the point of X two:')

yOne = ('Enter the point of Y one:')

yTwo = ('Enter the point of Y two:')

finalRectangle = ('{}'.format(calculaterectangle(rectLength,rectWidth)))

print('{:,.2f}'.format (calculaterectangle(rectLength,rectWidth)))

print('{:,.2f}'.format (calculatecircle(radius)))

print('{:,.2f}'.format (calculatetriangle(height,base)))

print('{:,.2f}'.format (calculatdistance(xOne,xTwo,yOne,yTwo)))

THIS IS THE MODULE ITSELF

import math

# Function: calculaterectangle

# Description: This function will calculate the area of a rectangle

# Input: The user is expected to enter length and width

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of sides

def calculaterectangle(rectLength,rectWidth):

rectangleArea = rectLength * rectWidth

return rectangleArea

# Function: calculatecircle

# Description: This function will calculate the area of a circle

# Input: The user is expected to enter radius

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of radius

def calculatecircle(radius):

circlArea = math.pi * radius ** 2

return circleArea

# Function: calculatetriangle

# Description: This function will calculate the area of a right triangle

# Input: The user is expected to enter base and height of triangle

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of base and height

def calculatetriangle(triangleBase,triangleHeight):

triangleArea = triangleBase*triangleHeight/2

return triangleArea

# Function: calculatedistance

# Description: This function will calculate the distance between two points

# Input: The user is expected to enter two coordinates

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of coordinates

def calculatedistance (xOne,xTwo,yOne,yTwo):

distance = math.sqrt((xTwo-xOne)**2 + (yTwo-yOne)**2)

return distance

It is throwing an error on line 37 that said calculaterectangle is not defined

import geometry # my custom input module

rectWidth = ('Enter the Width of rectangle:')

rectLength = ('Enter the length of rectangle:')

radius = ('Enter the radius of circle:')

triangleHeight = ('Enter the Height of triangle:')

triangleBase = ('Enter the Base of triangle:')

xOne = ('Enter the point of X one:')

xTwo = ('Enter the point of X two:')

yOne = ('Enter the point of Y one:')

yTwo = ('Enter the point of Y two:')

finalRectangle = ('{}'.format(calculaterectangle(rectLength,rectWidth)))

print('{:,.2f}'.format (calculaterectangle(rectLength,rectWidth)))

print('{:,.2f}'.format (calculatecircle(radius)))

print('{:,.2f}'.format (calculatetriangle(height,base)))

print('{:,.2f}'.format (calculatdistance(xOne,xTwo,yOne,yTwo)))

THIS IS THE MODULE ITSELF

import math

# Function: calculaterectangle

# Description: This function will calculate the area of a rectangle

# Input: The user is expected to enter length and width

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of sides

def calculaterectangle(rectLength,rectWidth):

rectangleArea = rectLength * rectWidth

return rectangleArea

# Function: calculatecircle

# Description: This function will calculate the area of a circle

# Input: The user is expected to enter radius

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of radius

def calculatecircle(radius):

circlArea = math.pi * radius ** 2

return circleArea

# Function: calculatetriangle

# Description: This function will calculate the area of a right triangle

# Input: The user is expected to enter base and height of triangle

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of base and height

def calculatetriangle(triangleBase,triangleHeight):

triangleArea = triangleBase*triangleHeight/2

return triangleArea

# Function: calculatedistance

# Description: This function will calculate the distance between two points

# Input: The user is expected to enter two coordinates

# Output: A message is displayed explaining what is expected from the user.

# Parameters: prompt - message to display to user

# Returns: user's input of coordinates

def calculatedistance (xOne,xTwo,yOne,yTwo):

distance = math.sqrt((xTwo-xOne)**2 + (yTwo-yOne)**2)

return distance

It is throwing an error on line 37 that said calculaterectangle is not defined