jeudi 10 septembre 2020

Placing an if statement within a function? [closed]

This is what I have so far:

def delivery(weight):
    if weight > 20:
        return delivery = 20
    if weight >= 20 and weight <= 50:
        return delivery = 20 + (weight)
    if weight > 50:
        return delivery = 10 + (1.2*weight)

delivery(30)

print(delivery)

I continue to get an incorrect outcome that says:

<function delivery at 0x7fb696c2fb90>

When I want my outcome to print 30. How can I fix this?

Aucun commentaire:

Enregistrer un commentaire