Question

In: Computer Science

implement a formula of your own choosing, as a Python function, following these instructions: You need...

implement a formula of your own choosing, as a Python function, following these instructions:

  • You need to write a function that takes multiple arguments (not input from the keyboard!), and that returns the result of a formula of your choosing (not printing the output on the screen!).
  • For your function definition, choose a formula from mathematics, science, or a related field.
  • Then, in the main part of the script, write the main Python code (outside of any function) that asks the user to input the appropriate values, then uses the function you just defined to do a calculation, and then outputs the result.
  • Make sure that the user of the script knows what they are expected to input, what the script is going to calculate, and what the output means. (Remember that units are important!)
  • Don't pick a formula that is too simple; make sure that it's got at least two variables, and that it uses more than one operation (so don't pick a formula such as the volume of a 'box' isVolume = length * width * height,

Solutions

Expert Solution

Thanks for the question, here is a financial function, that takes in the loan amount, annual interest rate and number of years and calculates the monthly interest rate and returns the monthly interest rate.

=============================================================

# function calculates monthly interest
# functions takes in loan amount, annual interest rate , total number of years

def calculate_monthly_interest(loan_amount,annual_interest,years):
    monthlyRate=annual_interest/1200
    months=years*12
    monthly_payment = loan_amount * ((monthlyRate * ((1 + monthlyRate) ** months)) / ((1 + monthlyRate) ** months - 1))
    return monthly_payment


def main():

    loan_amount = float(input('Enter Loan Amount: '))
    rate = float(input('Enter annual interest rate (%): '))
    years = float(input('Enter number of years: '))
    monthly_interest= calculate_monthly_interest(loan_amount,rate,years)
    print('Your monthly interest will be :${0:.2f}'.format(monthly_interest))

main()


Related Solutions

In this Java program you will implement your own doubly linked lists. Implement the following operations...
In this Java program you will implement your own doubly linked lists. Implement the following operations that Java7 LinkedLists have. 1. public DList() This creates the empty list 2. public void addFirst(String element) adds the element to the front of the list 3. public void addLast(String element) adds the element to the end of the list 4. public String getFirst() 5. public String getLast() 6. public String removeLast() removes & returns the last element of the list. 7. public String...
For this problem you will be creating your own linear model for data of your choosing....
For this problem you will be creating your own linear model for data of your choosing. Please do the following: • Find a data set that you believe to be linear. You can measure and collect your own data or search the internet. Be sure to cite where you get your data. • Plot the data on a coordinate plane. Include a link to this graph in your submission of this assignment. • Approximate a slope and intercept for your...
The programming language is Python Instructions: Create a function that will delete a node in a...
The programming language is Python Instructions: Create a function that will delete a node in a Linked List based on position number. On below example, if you want to delete position #2, it will remove the Banana (arrangement of nodes below is Apple, Banana, Cherry, Grapes, Orange). myLinkedList = LinkedList() myLinkedList.append("Banana") myLinkedList.append("Cherry") myLinkedList.append("Grapes") myLinkedList.append("Orange") myLinkedList.prepend("Apple") myLinkedList.deleteByPositionNum(2) node = myLinkedList.head while node: print(node.value, " ") node = node.next_node You may start with the function head: def deleteByPositionNum(self, positionNum):
Instructions: If you could open your own business or if you know of someone in your...
Instructions: If you could open your own business or if you know of someone in your family that has recently opened up a business, show me that you can begin to create your own marketing plan.  This is a draft so I do not expect perfection! Format it nicely on the page and bold or bullet point your headings. Simply show me that you know how to create a document like this and throughout the semester we may continue to build...
Instructions: You are givne main.c and exam.h. Your task is to implement exam.c. write the code...
Instructions: You are givne main.c and exam.h. Your task is to implement exam.c. write the code for these 20 functions on repl.it. */ #include #include "exam/exam.h" int main(void) { return 0; } /* /* exam.h */ #ifndef _EXAM_H_ #define _EXAM_H_ // 1 // Display title of code and your name. ( koorsh maghsoodi my name) // See exam.txt for sample output. void exam_hello_world(void); // 2 // Display argc and all argv[] values. // See exam.txt for sample output. // returns:...
PYTHON: This is the posted problem: General Instructions Create a function called DeterminePrice that will determine...
PYTHON: This is the posted problem: General Instructions Create a function called DeterminePrice that will determine the cost of purchased software. The price is of the software is $350 per license. However, when purchased in larger quantities a discount is given. For quantites less than 10 copies, there is no discount. For quantities greater than 10 and less than and including 20, a 10% discount is given. For quantities greater than 20 and less than and including 30, a discount...
Python - No libraries - No count() function allowed You need to travel 100 miles via...
Python - No libraries - No count() function allowed You need to travel 100 miles via rental car. There are several cars on the lot to choose from, each with their own MPG (miles per gallon) rating. Some cars have a manual transmission, while others do not (they're automatic). The price for gas in the area is $3 per gallon. Cars that have a manual transmission get a 10% discount at the pump. To streamline your selection, the car rental...
Suppose you were given an opportunity to own a business of your choosing. First, briefly describe...
Suppose you were given an opportunity to own a business of your choosing. First, briefly describe your business; then explain the most efficient way to raise capital to either start or expand your business. Provide support for your response. Please Note- You just need to choose one way, and explain why the option selected is most efficient. Also, state whether capital is for starting or expanding the business.
You can select an operations management environment of your own choosing, however ensure it is realistic...
You can select an operations management environment of your own choosing, however ensure it is realistic and real world applicable, reflecting good judgment, business sense, and critical thinking skills. Consider the following topic and follow the instructions below; remembering to complete all elements of your Assessment: Facility Design Create a facility design within an operations management environment, using real world research to support your work. At the beginning of your paper, introduce your planned work, to include a description of...
Python Add your own implementation of the function rearrange_list rearrange_list(linkedlist, number) returns the result of rearranging...
Python Add your own implementation of the function rearrange_list rearrange_list(linkedlist, number) returns the result of rearranging the nodes in linkedlist so that: all the nodes whose values are less than number are at the front all the nodes whose values are greater than number are at the rear any nodes whose values are equal to number are in the middle For example, given the linked list represented by linkedlist = -2 -> -3 -> -1 -> 2 -> 3 ->...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT