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

Connected

Exercise

Comparing dividends

Dividends are payments made to stockholders, usually from profits that are not re-invested in a company. It is important to identify which stocks are paying higher dividends when analyzing how to balance stocks in a portfolio. Let's say that in your role analyzing a client's portfolio, you are tasked with comparing dividends from different holdings. The values of these dividends are provided in the variables d1 and d2.

Instructions 1/2

undefined XP
  • 1
    • Find out if dividend d2 is greater than zero.
    • See if dividend d1 is greater than d2.
  • 2
    • Check that dividend 1 is at least 100 units.
    • Check that dividend 1 is not more than dividend 2.