+ 4
this Shiping cost code practice .this working
#taking the weight as input weight = int (input()) #complete the function def shiping_cost(weight): print (weight*5) #function call shiping_cost(weight)
12 ответов
+ 2
doesn't work
+ 2
imaging you need to calculate the shipping cost for customer order based on the weight of the packages
The cost per kilogram is 5$
comment the shipping_cost() functions take the weight as an argument, calculate the shipping cost based on the weight ,and display it in the given Format the
function call is already done.
+ 2
It is from "Shipping cost" in Python intermediate or developer.
Full description:
Imagine you need to calculate the shipping cost for customer orders based on the weight of the packages.
The cost per kilogram is $5.
Task
Complete the shipping_cost() function to take the weight as an argument, calculate the shipping cost based on the weight, and display it in the given format.
The function call is already done.
Your code does work and I tested it.
Must be some misspelling or extra space in your code.
+ 2
thanks guys
+ 2
it didn't out put the code due to a spelling mistake
+ 1
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪 ,
I don't remember that one. Are you sure that's all the description requires? If so, you could just do this.
print(5 * int(input()))
+ 1
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪 ,
Then there must be more to it.
Can you copy and paste the exact description here? Sometimes the wording gives a critical clue.
+ 1
Wong Hei Ming ,
OK. Found it. It's in the Functions module of the course.
And "the given format" refers to an illustration that shows int outputs, so input 5 should produce output 25, not 25.0.
0
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪 ,
That's not a copy and paste. Those are your own hand-written words. I can't tell what's missing until you paste the original Sololearn text from the lesson or code coach.
0
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪 ,
Do you mean shiping instead of shipping?
That shouldn't matter since you spelled it that way in both the function definition and the function call, because any legal name works as long as you're consistent.
You need to learn how to copy and paste. You can't ask what's wrong with your code and retype it by hand, because you might not retype the error.
0
Wong Hei Ming ,
I found it where you said it was. I'll just add that it's in the Functions module of the course, and "the given format" refers to an illustration that shows int outputs, such as input 5 outputs 25, not 25.0.
0
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪 ,
Also, none of the test cases is locked in that practice test. You should have been able to tell what was wrong by opening any of them and seeing your output versus the expected output.