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

Exercise

Accessing datetime attributes

Suppose you are analyzing the tech bubble crash of 2000. For the sake of reporting, you need to assign the year, month, and day values to variables.

Use the attributes of a datetime object to assign the correct values to these variables.

Instructions

100 XP
  • Assign the year of the crash to the variable yr.
  • Assign the month of the crash to the variable mth.
  • Assign the day of the crash to the variable day.