helloworld.py

# worstcode.py # # Description: A program that is very easily breakable and needs to improved. # # Date: 09/12/2015 # Written By: D.Barry # divide() # # This function divides two numbers and returns the result. If the divide # cannot be done, this function returns zero. # # @param a The first number. # @param b The second number. # @return The result of the operation. def divide(a, b) : return a / b # getFloat() # # Gets a number from the user and returns it in this method. If the number is # invalid this function asks the user to enter another number. # # @param msg The message to be displayed to the user. # @param The number the user entered. def getFloat(msg) : return float(input(msg)) # main() # # An example of how the program will be used. def main() : numA = getFloat("First number>") numB = getFloat("Second number>") result = divide(numA, numB) print(numA, "/", numB, "=", result) return # test() # # Run the test code in here. def test() : # TODO: Write some test code! return # Run tests test() # Run main main()