Please help me with the code sals shipping

I wrote the below code and tested

def cS(weight):

  if gs(weight) < ds(weight):

    print("Cheapest shipping method is ground shipping. " + "The total cost is " + str(gs(weight)))

  else:

    print("Cheapest shipping method is drone shipping. " + "The total cost is " + str(ds(weight)))

print(cS(4.5))

print(cS(41.5)

The output is

Cheapest shipping method is ground shipping. The total cost is 33.5
None
Cheapest shipping method is ground shipping. The total cost is 217.125
None

why is ‘None’ coming up here?

Please see the following FAQ which describes how to post code snippets to the forums as formatting and indentation makes it much easier to interpret your code.

When you call a function and no valid return (or yield) statements are executed before the function finishes it will always return the None object.

1 Like