Hello, im trying to use a function inside another function and getting an error:
The function:
# Function that recieves number of characters and calculate cost of advertising
def costAd(numChar):
if numChar >= 15:
cost = 35.00
else:
cost = 35.00 + ((numChar - 15) * 3.55)
return cost
costAd()
Function where im using it on:
from costAd import *
def main():
costMsg = 0.00
totalCost = 0.00
# apply for loop, with range of 11
for x in range(1,11):
msgLen = input("Enter the length of message" + str(x)+ ": ")
costMsg = costAd(msgLen)
totalCost += costMsg
print "For 10 messages, the cost is: RM %.2f" %(totalCost)
main()
The error:
TypeError: costAd() takes exactly 1 argument (0 given)