curriculum/challenges/english/blocks/daily-coding-challenges-python/696655d24b614176d4c9b78d.md
Given a timestamp (number of milliseconds since the Unix epoch), return:
"odd" if the day of the month for that timestamp is odd."even" if the day of the month for that timestamp is even.For example, given 1769472000000, a timestamp for January 27th, 2026, return "odd" because the day number (27) is an odd number.
Note: The timestamp is in milliseconds and you should use the date in the UTC timezone, not in your local time.
odd_or_even_day(1769472000000) should return "odd".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even_day(1769472000000), "odd")`)
}})
odd_or_even_day(1769444440000) should return "even".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even_day(1769444440000), "even")`)
}})
odd_or_even_day(6739456780000) should return "odd".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even_day(6739456780000), "odd")`)
}})
odd_or_even_day(1) should return "odd".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even_day(1), "odd")`)
}})
odd_or_even_day(86400000) should return "even".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(odd_or_even_day(86400000), "even")`)
}})
def odd_or_even_day(timestamp):
return timestamp
from datetime import datetime
def odd_or_even_day(timestamp):
dt = datetime.utcfromtimestamp(timestamp / 1000)
day = dt.day
return "even" if day % 2 == 0 else "odd"