160,104 views
30 votes
30 votes
If (accountBalance < 1000.00):

print(“SAVINGS3”)
elif (accountBalance < 2000.00):
print(“SAVINGS2”)
elif (accountBalance < 3000.00):
print(“SAVINGS1”)
else:
print(“SAVINGS”)

User Kristo
by
2.7k points

1 Answer

14 votes
14 votes

Answer:

See explanation

Step-by-step explanation:

Given

The code segment

Required

The output

The code segment is incomplete, as the value of accountBalance is not given.

However, I will explain the given segment using few illustrations.

The following will be executed if accountBalance is less than 1000.00

if (accountBalance < 1000.00):

print(“SAVINGS3”)

Take for instance:

accountBalance = 500.0; "SAVINGS3" will be printed

The following will be executed if accountBalance is less than 2000.00 but more than or equal to 1000.00

elif (accountBalance < 2000.00):

print(“SAVINGS2”)

Take for instance:

accountBalance = 1500.0; "SAVINGS2" will be printed

The following will be executed if accountBalance is less than 3000.00 but more than or equal to 2000.00

elif (accountBalance < 3000.00):

print(“SAVINGS1”)

Take for instance:

accountBalance = 2500.0; "SAVINGS3" will be printed

Lastly, if accountBalance is 3000.00 or greater, the following will be executed

else:

print(“SAVINGS”)

Take for instance:

accountBalance = 3500.0; "SAVINGS" will be printed

User Chetan Sisodiya
by
2.6k points