Shipping charge based on weight The program here is simply supposed to tell you the shipping charge based off of the weight of the package. I am just wondering if there is any further way to concise it? At the moment, I do not think it can go any further than that. The only place where I'm unsure whether I could improve it, could be Booleans. Possibly use a while statement?

def main():

    weight = eval(input("Please enter the weight of the package: "))

    rate = 0

    if weight &lt;= 2:
        rate += 1.25
    elif weight &gt; 2 and weight &lt;= 5:
        rate += 2.35
    elif weight &gt; 5 and weight &lt;= 10:
        rate += 4.05
    elif weight &gt; 10:
        rate += 5.55

    charge = rate * weight

    print("The shipping charge is: $%s" % charge)

print(main())
You are checking much more than you need to. Consider the first two cases:

if weight &lt;= 2:
    # A
elif weight &gt; 2 and weight &lt;= 5:
    # B


If weight &lt;= 2, we fall into case A. If we're not in case A, only then do we continue onto the next condition checks (because we're using elif and not if). As such, if we're even in the path that checks the condition which leads to B, we already know that weight &gt; 2. Thus, that check is redundant and can be reduced to simply weight &lt;= 5.

The whole body can become:

if weight &lt;= 2:
    rate += 1.25
elif weight &lt;= 5:
    rate += 2.35
elif weight &lt;= 10:
    rate += 4.05
else:
    rate += 5.55


Which isn't just less code, it's easier to reason about since all your bounds are visually in the same column.