Assignment UserDefinedFunctions
Assignment UserDefinedFunctions
In this assignment, you will create two python files. Name the two files as follows:
1. YourName_Functions.py
2. YourName_Test.py
File1 contains all the definition of the functions. File2 contains a test function for each function
in file1.
Here is an example.
Let’s do the first progblem from this assignment. In file1, define the function given below.
In file 2 , you will create a test function that will call the above function.
Sample Run
3. Application -----------------------------------------------------------------------isPalindrome()
(Palindrome integer) Write the functions isPalindrome that
# Return the reversal of an integer, e.g. reverse(456)
returns
# 654
def reverse(number):
# Return true if number is a palindrome
def isPalindrome(number):
Use the reverse function to implement isPalindrome. A number is a palindrome if its
reversal is the same as itself. Write a test program that prompts the user to enter an
integer and reports whether the integer is a palindrome.
6. Application ----------------------------------------------------------------------displayPattern()
(Display patterns) Write a function to display a pattern as follows:
Write a test program that prompts the user to enter a number n and invokes
displayPattern(n) to display the pattern.
Write a test program that prompts the user to enter the investment amount and the annual
interest rate in percent and prints a table that displays the future value for the years from
1 to 30. Here is a sample run:
This function will prompt the user for the function Number to run (1-14) and then it will
ask the user to enter the parameter for the function chosen if there are any.
Here is a sample Run
6
Writing Functions ICS3U1
Your program should continuously ask for the function number to run until the user
enters -1.