this Shiping cost code practice .this working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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)

16th Dec 2023, 10:34 AM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
12 Answers
+ 2
doesn't work
16th Dec 2023, 11:20 AM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 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.
16th Dec 2023, 2:39 PM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 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.
16th Dec 2023, 2:59 PM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
thanks guys
16th Dec 2023, 3:07 PM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 2
it didn't out put the code due to a spelling mistake
16th Dec 2023, 8:02 PM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 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()))
16th Dec 2023, 10:56 AM
Rain
Rain - avatar
+ 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.
16th Dec 2023, 12:04 PM
Rain
Rain - avatar
+ 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.
16th Dec 2023, 7:53 PM
Rain
Rain - avatar
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.
16th Dec 2023, 2:43 PM
Rain
Rain - avatar
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.
16th Dec 2023, 8:12 PM
Rain
Rain - avatar
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.
16th Dec 2023, 8:19 PM
Rain
Rain - avatar
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.
16th Dec 2023, 8:22 PM
Rain
Rain - avatar