Dec-17-2017, 02:38 PM
I mean the that part of the code dose nothing unless it been called to run.
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Unit 18: Procedural Programming Assignment (Shop Simulation)
|
Dec-17-2017, 02:38 PM
I mean the that part of the code dose nothing unless it been called to run.
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Dec-17-2017, 02:46 PM
so how do i call it
This is your function
def newbalances(initialbalance, productname, advertisingcost): newbalance = initialbalance - advertisingcost - ptoductname * wholesaleprice return newbalanceNow to call it you need to assign it a variable (let call it todayBalance) and give it 3 arguments. todayBalance=newbalances(0, 'Nick', 100)I think wholesaleprice is a global variable...
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Dec-17-2017, 03:01 PM
yes wholesale price is global
I dont get why productname is part of the equation. Anyway change 'Nick' to a number. Doing this on a phone is hard.
And you variable ptoductname need changing
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Dec-17-2017, 03:07 PM
(Dec-17-2017, 02:59 PM)Terafy Wrote: This is your function where should i put this part of the code
Dec-17-2017, 03:19 PM
Anywhere below the functions you defined
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Dec-17-2017, 06:48 PM
(This post was last modified: Dec-17-2017, 06:49 PM by shaheduk323.)
I give up. i had enough of the coding and whatever i define its the same error. my deadline is 11:55pm tonight and so i am too late just thought to tell you. the error kept on coming up even if i tried to define it.
no dont give up! it was 1 am since my last post!
In a new script paste this code. def newbalances(initialbalance, productname, advertisingcost): wholesaleprice = 9 newbalance = initialbalance - advertisingcost - productname * wholesaleprice return newbalance #calling the function newbalances #need input arguments (initialbalance, productname, advertisingcost) #and a variable to store it todayBalance=newbalances(1000, 10, 100) print(todayBalance) If you ran that code you would get:
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Homework Python unit test | Paragoon2 | 4 | 2,362 |
Dec-12-2022, 12:45 PM Last Post: Paragoon2 |
|
Unit Testing is not showing Test case result | mbilalshafiq | 2 | 2,506 |
Jul-01-2020, 08:50 PM Last Post: mbilalshafiq |
|
Simulation | DaRTHYGT | 2 | 3,648 |
Jan-27-2020, 10:09 PM Last Post: micseydel |
|
Help with Unit Tests | pdub787 | 3 | 3,933 |
Nov-20-2019, 07:45 PM Last Post: ndc85430 |
|
Verilog HDL Programming to Python Programming? | noobcoder | 1 | 3,757 |
Jul-18-2019, 09:28 PM Last Post: nilamo |
|
Help for my assignment - Object Oriented Programming | denizkb | 5 | 6,391 |
Jan-05-2019, 06:43 PM Last Post: stullis |
|
Unit 18 Procedural Programming Python | kanwal121 | 4 | 5,028 |
Dec-21-2017, 10:53 PM Last Post: Terafy |
|
unit 18 codes | Miss_Kaur | 7 | 6,414 |
Dec-19-2017, 02:49 PM Last Post: sparkz_alot |
|
Unit 18 Procedural Programming Python | kanwal121 | 6 | 5,241 |
Dec-17-2017, 07:18 PM Last Post: Terafy |
|
programming assignment | mario | 2 | 4,304 |
Dec-16-2017, 06:28 PM Last Post: DeaD_EyE |