Bank customer¶
Write the function customer() that takes the balance of a
bank customer, and returns a string showing the customer type using
the following rules. If the bank account balance is greater or equal
than 1000 Euros the function returns the string 'reliable'. If it is
less than 1000 Euros but positive, returns the string 'precarious'. If the
balance is 0 or negative but greater than -1000 Euros, the customer
type is 'short on' and if it is less than or equal to -1000 Euros,
the customer type is 'defaulting'. Solve this exercise in two
different ways: with and without nested if statements.
Save this function into a file named customer.py.
See the following examples:
>>> customer (1000) 'reliable' >>> customer (234765) 'reliable' >>> customer (347) 'precarious' >>> customer (1) 'precarious' >>> customer (0) 'short on' >>> customer (-800) 'short on' >>> customer (-1000) 'defaulting' >>> customer (-4300) 'defaulting'Note
More tests are provided in the
test-customer.txtfile.
Solution
A solution is provided in the
customer.py file.