Dec-16-2017, 10:05 PM
(This post was last modified: Dec-16-2017, 10:05 PM by shaheduk323.)
(Dec-16-2017, 08:36 PM)j.crater Wrote: User inputs a value, that is stored into a variable. And you can return the value of that variable from a function, as you did in other functions.i did that and it still shows the same error. i did return advertising cost
def newbalance(): newbalance = initialbalance - (productname * advertcost) return newbalance def advertisingcost(): advertcost = int(input("How much do you want to spend on advertising cost in £? ")) return advertisingcost def randmnum(): randmnum = random.randint(1,100) # "30 Days Simulation loop" days = 0 while days <30: days = days +1 print("days", + (days)) randmnum = random.randint(1,100) figuresales = (randmnum * advertisingcost()) print ("The figure sales is £" +str (figuresales))
still the same error
Error:days 1
How much do you want to spend on advertising cost in £? 55
Traceback (most recent call last):
File "C:\Users\Shahed\Desktop\Python\Portable Python 3.2.1.1\assignment python.py", line 44, in <module>
figuresales = (randmnum * advertisingcost() )
TypeError: unsupported operand type(s) for *: 'int' and 'function'
>>>