Decisions with Boolean operations
Boolean operations are used in Python to make decisions. Imagine that you work as an analyst identifying accounts that might potentially participate in stock trades. You might use this information to advise qualifying clients on market moves.
The variable is_investment_account
is supplied. It is set to True
if the given account includes stock positions as part of it's holdings. The supplied variable balance_positive
is set to True
if the account has a positive cash balance, which could be used to purchase securities.
Este ejercicio forma parte del curso
Intermediate Python for Finance
Instrucciones del ejercicio
- Print the value of the variable
balance_positive
. - Set the variable
potential_trade
toTrue
if the account is an investment account with a positive balance. - Print the
True
if this is a potential trade.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Print the given variables
print(is_investment_account)
print(____)
# Decide if this account is cantidate for trading advice
potential_trade = is_investment_account ____ balance_positive
# Print if this represents a potential trade
print(____)