+ 1

What am I doing wring?

Im working on functions for python. Here is the question ==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.== Here's what I got. #taking the weight as input weight = int(input()) #complete the function def shipping_cost(weight): shipping_cost = weight * 5 #function call shipping_cost(weight) Whst am I doing wrong/missing?

9th Aug 2025, 2:45 AM
Joshua Jones
Joshua Jones - avatar
1 Resposta
+ 6
Joshua Jones you can not define your function then try to create a variable with the same name shipping_cost is the function and don't forget to return weight * 5 def shipping_cost(weight): return weight * 5 weight = int(input()) print(shipping_cost(weight))
9th Aug 2025, 3:27 AM
BroFar
BroFar - avatar