I'm new to python, so this might be super easy, however, I want to the user to write the weight of the package. Package 1, we can call it. Then the user can write the weight for another package, etc. In the end, the code adds the prices together, and it writes out the total price.
This is the code I have. It only does it for 1 package. Not sure how to more than 1 package.
def package_price(kg):
if kg < 0:
return "The number is negative "
if kg <= 10:
return "That would be 149kr"
elif kg <= 25:
return "That would be 268kr"
elif kg <= 35:
return "That would be 381kr"
else:
return "The package is too heavy"
weight = input("How much does the package weight?: ")
kg = int(weight)
package = package_price(kg)
print(package)
inputstatement, like you did forweightand add the result to the first input.package_pricein the context of your question?