1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Python for Finance

Exercise

Negating with Boolean operators

It is often the case that you need to combine Boolean operations to solve more complicated problems. Let's say that you need to know if you need to download the closing stock prices for today. You only want to do the operation if the markets have already closed. The closing prices are a list held in the provided variable closing_prices. The supplied variable market_closed is set to True once the markets close. Use Boolean operations and what you know about how objects evaluate in them to determine if you should download the data.

Instructions

100 XP
  • Set the variable not_prices to True if you do not have closing prices for today.
  • Set the variable get_prices to True if the market is closed and you don't have closing prices yet.