Python Forum
A Problem With The Body of My Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Problem With The Body of My Function
#1
Hello,

I'm writing here with only a slight degree of knowledge, but I think, I hope, this is the right place to ask the right questions.

Okay, I have set up code where I have to do the following:

perform a calculation underneath my header,

def volume(cargo):


THE BODY IS HERE.




Further down, I have the following assert commands

test_volume():

assert volume(cargo) = a number
assert volume(cargo) = a number

test_volume()

the number (a number) to the right of the assert command can't be greater than the total_net_load of the truck when it is MULTIPLIED BY THE CARGO, and … well … I HAVE THAT NUMBER for the total_net_load, and I have the number for the cargo in the expression after the assert commands (a number is written in), but how in the hell do I transfer this up to the function - WHICH I MUST USE THE RETURN FUCNTION FOR - so this is stored in the shell-memory?


I have thought up the following ''code''; but of course it fails.

def volume(cargo)
'''Statement here'''
total_net_load = x
cargo / total_net_load = a number
return <= a number

okay, I'm going to try this one out I have just wrote, but if it doesn't work i'm posting this question - thanks. didn't work: please, someone with a higher IQ than me, please point me in the right direction.


Also, I must add, i'm not looking for the answer, just a an explination of what where my thinking is wrong, thanks.
Reply


Messages In This Thread
A Problem With The Body of My Function - by Billy_Papke - Jul-01-2020, 12:42 PM

Forum Jump:

User Panel Messages

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