# Chapter 3: Variables, Values, Types, Strings, and Dates
# Fundamentals of Python for Financial Econometrics - Variables, Values, Types, Strings, and Dates
# Dataset: Ceteris Lab teaching sample

# Variables, Values, Types, Strings, and Dates
#
# **Opening question:** How does Python know whether a value is a price, a label, a date, or a logical condition?

# %% Cell 2
country = "Canada"
policy_rate = 0.0275
observations = 120
is_monthly = True

print(type(policy_rate).__name__)
print(f"{country}: {policy_rate:.2%}, n={observations}, monthly={is_monthly}")

# **Interpretation check:** Interpretation. The format specification changes presentation, not the stored value.

# %% Cell 4
from datetime import date

start = date.fromisoformat("2026-01-01")
end = date.fromisoformat("2026-08-15")
print((end - start).days)
print(start < end)

# **Interpretation check:** Interpretation. ISO dates avoid day-month ambiguity and support calendar arithmetic.

# %% Cell 6
print(type(policy_rate).__name__)
print(f"{country}: {policy_rate:.2%}, n={observations}, monthly={is_monthly}")
from datetime import date
start = date.fromisoformat("2026-01-01")
end = date.fromisoformat("2026-08-15")
print((end - start).days)

# Verified source output
#
# ```text
# float Canada: 2.75%, n=120, monthly=True
# ```
#
# ```text
# 226 True
# ```
#
# ```text
# float
# Canada: 2.75%, n=120, monthly=True
# ```
#
# ```text
# 226
# True
# ```
