dimanche 5 novembre 2017

How to ask for input variables in an if statement?

I want a program that helps me quickly solve multiple functions. The goal is that certain prompts would ask for specific inputs so I don't have to input all my variables at the beginning. My first function problem type bond yields is attempted here but the variables are not defined.

q = input("What Problem are you trying to solve: ")
    if  q == "a" or "a)" or "A":
        PMT = input("What is the payment: "))
        i = input("What is the interest: "))
        Call_price = input("What is the call price: "))
        n = (input("How many years will it compound?: "))
        print (PMT*[(1-(1/(1+i)^n)/i]+  Call_price/(1+i)^i)

Aucun commentaire:

Enregistrer un commentaire