Question on Python Project Sal's Shipping

Hello,

So first of all when I printed, it showed this;

The shipping method will be ground shipping and it will cost 34.4$ .
None
The shipping method will be premium shipping and it will cost 125.0$ .
None

My question is why is it writing ‘‘None’’, and how can I remove it and how can it be 34.40$ instead of 34.4$, thanks for the help and here’s my code;


CHECK RESPONSES FOR THE REST OF THE CODE

Annotation 2020-08-26 1826441

It’s because your statement on line 47 is a print statement.

So you’re double printing and not returning anything (that’s the None bit). You can either return the string as you have it, or just call the function without printing it.

It depends contextually on what you would want to do with it overall.

1 Like

To answer your question on how to print $34.40 rather than $34.4, you can use the .format() string method to specify the number of decimal places you want. More on this here.

1 Like