Quantcast
Channel: DaniWeb Solved Topics
Viewing all articles
Browse latest Browse all 587

Shipping Program

$
0
0

Hello, I have run into an issue where my output for shipping charge needs to be Real
Use local named constants not global
Also the package weight needs to be times the rate PER pound, is what I have correct?

rate1= 1.1
rate2= 2.2
rate3= 3.7
rate4= 3.8

def main():
   packageWeight = float(input( "What is the weight of the package?"))
   shipping_Weight(packageWeight)

def shipping_Weight(packageWeight):
    if packageWeight <= 2:
       Weight = rate1 * packageWeight
       print ("The total shipping charge is $: " , Weight)

        elif packageWeight <= 6:
            Weight = rate2 * packageWeight
            print ("The total shipping charge is $: " , Weight)

        elif packageWeight <= 10:
            Weight = rate3 * packageWeight
            print ("The total shipping charge is $: " , Weight)

        elif packageWeight > 10:
            Weight = rate4 * packageWeight
            print ("The total shipping charge is $: " , Weight)

main()

Viewing all articles
Browse latest Browse all 587

Trending Articles