(Very Newbie) Problems defining a variable

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Dec 12 07:10:47 EST 2008


On Fri, 12 Dec 2008 04:05:21 -0800, feba wrote:

> that's it, thanks! was confused with it being basically in a column of
> all >= *.
> 
> I replaced it with
> 
> 	if bank <= 0:
> 		print("You're in the red!")
> 		quit()
> 	elif bank >= 1 and bank <= 9999:
> 		rate = 0.0060

You can replace this with the simpler, easier to read and faster:

elif 1 <= bank <= 9999:
    rate = 0.0060
elif 10000 <= bank <= 24999:
    rate = 0.0085

...

> 	elif bank >= 100000:
> 		rate = 0.0173
> 	else:
> 		print("What's this doing here?")

Change the last two else clauses to this one:

else:
    rate = 0.0173



-- 
Steven



More information about the Python-list mailing list