Question

In: Computer Science

Python 3: Write a function called Interest with floating point parameters Amount and InterestPercent that calculates...

Python 3:

Write a function called Interest with floating point parameters Amount and InterestPercent that calculates the simple interest on Amount using InterestPercent as the interest rate.The function should return the interest amount.

Solutions

Expert Solution

Please upvote if you like the answer, as it helps the community a lot.

Also if you have any doubts, feel free to ask in comments, we will reach you ASAP.

NOTE: Be careful with the indentation, because they are very important in Python.

CODE(InterestCalculator.py):

# ANSWER STARTS
# function that returns Interest
def interest(Amount,InterestPercent):
   InterestAmount = 0.01*InterestPercent*Amount
   return InterestAmount

# ANSWER ENDS

# testing the written function
Amount = 10000
InterestPercent = 5
Interest = interest(Amount,InterestPercent)
print("Interest: " + str(Interest))

SAMPLE OUTPUT:


Related Solutions

In Python: Write a function called sum_odd that takes two parameters, then calculates and returns the...
In Python: Write a function called sum_odd that takes two parameters, then calculates and returns the sum of the odd numbers between the two given integers. The sum should include the two given integers if they are odd. You can assume the arguments will always be positive integers, and the first smaller than or equal to the second. To get full credit on this problem, you must define at least 1 function, use at least 1 loop, and use at...
Write a Python program: The function is named validity(). It receives 2 floating point parameters, min...
Write a Python program: The function is named validity(). It receives 2 floating point parameters, min and max, from the program that invoked it. The function asks the user to enter a float number. Using a while loop it checks whether the number is valid (between min and max, inclusive). If not valid, the while loop uses this statement to prompt for a new number: num = float (input (" Enter a number that is at least :"+ str(min) +...
In PYTHON Write an algorithm for a function called removeAll which takes 3 parameters: an array...
In PYTHON Write an algorithm for a function called removeAll which takes 3 parameters: an array of array type, a count of elements in the array, and a value. As with the remove method we discussed in class, elements passed the count of elements are stored as None. This function should remove all occurrences of value and then shift the remaining data down. The last populated element in the array should then be set to None. The function then returns...
Python: Implement a function called monthlyAmortization() that takes the following parameters: the principal amount of the...
Python: Implement a function called monthlyAmortization() that takes the following parameters: the principal amount of the loan (p) the interest rate, or annual rate (r) the term of the loan in months (t) the payment amount each period (monthlyPayment) The function prints the amortization table to a file called amoritizedLoan.txt. At the end of this file, the fucntion prints the total amount of interest paid for the loan. The output needs to be nicely formatted as shown below. The example...
In Java Write a method called findMax that accepts three floating-point number as parameters and returns...
In Java Write a method called findMax that accepts three floating-point number as parameters and returns the largest one.(hints: use conditional statement in the method)
This is an intro to python question. #Write a function called search_for_string() that takes two #parameters,...
This is an intro to python question. #Write a function called search_for_string() that takes two #parameters, a list of strings, and a string. This function #should return a list of all the indices at which the #string is found within the list. # #You may assume that you do not need to search inside the #items in the list; for examples: # # search_for_string(["bob", "burgers", "tina", "bob"], "bob") # -> [0,3] # search_for_string(["bob", "burgers", "tina", "bob"], "bae") # -> []...
Python Problem 3 Write a function named enterNewPassword. This function takes no parameters. It prompts the...
Python Problem 3 Write a function named enterNewPassword. This function takes no parameters. It prompts the user to enter a password until the entered password has 8-15 characters, including at least one digit. Tell the user whenever a password fails one or both of these tests.
using python 1. #Write a function called multiply_file_by_index. This function #should take two parameters, both strings....
using python 1. #Write a function called multiply_file_by_index. This function #should take two parameters, both strings. The first string is #the filename of a file to which to write (output_file), and #the second string is the filename of a file from which to read #(input_file). # #In the input file, there will be an integer on every line. #To the output file, you should write the integer from the #original file multiplied by the line number on which it #appeared....
USING PYTHON 3.7 AND USING def functions. Write a function called GPA that calculates your grade...
USING PYTHON 3.7 AND USING def functions. Write a function called GPA that calculates your grade point average (GPA) on a scale of 0 to 4 where A = 4, B = 3, C = 2, D = 1, and F = 0. Your function should take as input two lists. One list contains the grades received in each course, and the second list contains the corresponding credit hours for each course. The output should be the calculated GPA. To...
IN PYTHON Create a function called biochild.  The function has as parameters the number m...
IN PYTHON Create a function called biochild.  The function has as parameters the number m and the lists biomother and biofather.  The biomother and biofather lists contain 0’s and 1’s.  For example: biomother = [1,0,0,1,0,1] and biofather = [1,1,1,0,0,1]  Both lists have the same length n.  The 0's and 1's represent bits of information (remember that a bit is 0 or 1).  The function has to generate a new list (child).  The child...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT