Today I am going nuts. This is another one that is not working. It keeps giving me syntax error at highlighted line. No matter what I do I still have that error at the same line. It seems that my first input line has an error which gives me a error message at second line. I just do not know what is the error. Syntax???
Andy
-
def accountInfo(custName, accountNum, startingBalance, deposit, years):
-
custName = (raw_input ("Please enter your name: ")
-
accountNum = int (raw_input ("Please enter your account number: ")
-
startingBalance = float (raw_input ("Please enter your starting balance: ")
-
deposit = int (raw_input ("Please enter amount you are depositing: ")
-
years = int (raw_input ("Please enter the years you are depositing the money: ")
-
-
def calculate(balance, newBalance):
-
balance = 0
-
balance += deposit
-
count = 0
-
while count <= years:
-
newBalance = balance * (1 + interest)** years
-
newBalance += newBalance
-
print "Balance for the year " + count + " is " + newBalance
-
-
-
#Main------------------------------------------------------------
-
-
print "Welcome to the First Charter Bank\n"
-
accountInfo()
-
calculate()
-
-
Check your parentheses. They must balanced.
You have argument lists in your function definitions, but you are not passing arguments to the functions when they are called. Your functions may need to return someting back.
Call function with arguments:
- calculate(balance, deposit, interest)
Assign variables to a function call that returns a list of values:
- custName, accountNum, startingBalance, deposit, years = accountinfo()
Function that receives no argument but returns a list:
- def accountInfo():
-
custName = raw_input ("Please enter your name: ")
-
accountNum = int (raw_input ("Please enter your account number: "))
-
startingBalance = float (raw_input ("Please enter your starting balance: "))
-
deposit = int (raw_input ("Please enter amount you are depositing: "))
-
years = int (raw_input ("Please enter the years you are depositing the money: "))
-
return custName, accountNum, startingBalance, deposit, years
Notice the
return statement. Check your parentheses. Return values to function calls where necessary. Pass arguments to functions where necessary. You are on the road to OOP.