Python Forum
Unit 18: Procedural Programming Assignment (Shop Simulation)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unit 18: Procedural Programming Assignment (Shop Simulation)
#9
(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' >>>
Reply


Messages In This Thread
RE: Unit 18: Procedural Programming Assignment (Shop Simulation) - by shaheduk323 - Dec-16-2017, 10:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework Python unit test Paragoon2 4 2,454 Dec-12-2022, 12:45 PM
Last Post: Paragoon2
  Unit Testing is not showing Test case result mbilalshafiq 2 2,581 Jul-01-2020, 08:50 PM
Last Post: mbilalshafiq
  Simulation DaRTHYGT 2 3,739 Jan-27-2020, 10:09 PM
Last Post: micseydel
  Help with Unit Tests pdub787 3 4,047 Nov-20-2019, 07:45 PM
Last Post: ndc85430
  Verilog HDL Programming to Python Programming? noobcoder 1 3,839 Jul-18-2019, 09:28 PM
Last Post: nilamo
  Help for my assignment - Object Oriented Programming denizkb 5 6,554 Jan-05-2019, 06:43 PM
Last Post: stullis
  Unit 18 Procedural Programming Python kanwal121 4 5,152 Dec-21-2017, 10:53 PM
Last Post: Terafy
  unit 18 codes Miss_Kaur 7 6,606 Dec-19-2017, 02:49 PM
Last Post: sparkz_alot
  Unit 18 Procedural Programming Python kanwal121 6 5,389 Dec-17-2017, 07:18 PM
Last Post: Terafy
  programming assignment mario 2 4,401 Dec-16-2017, 06:28 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020