생리 주기 계산기
다음 생리일·배란일·가임 기간을 예측합니다.
생리 주기 계산기는 마지막 생리 시작일과 평균 주기 길이를 기반으로 다음 생리 예정일, 가임 기간, 배란일을 예측합니다. 생리 주기는 일반적으로 21~35일이며 평균 28일이 많이 언급되지만, 개인마다 다릅니다.
사용 방법: 마지막 생리 시작일과 평균 주기 길이를 입력하면 다음 생리 예정일, 배란 예상일(28일 주기 기준 약 14일차), 가임 기간이 바로 계산됩니다. 향후 여러 주기를 한꺼번에 확인할 수도 있습니다.
이 계산기는 계획과 인식을 위한 유용한 추정치를 제공하지만, 주기는 스트레스, 질병, 운동, 호르몬 변화 등에 따라 달라질 수 있습니다. 임신이나 피임과 관련된 의학적 결정은 반드시 의료 전문가와 상담하세요.
자주 묻는 질문
코드 구현
from datetime import date, timedelta
def menstrual_cycle(last_period: date, cycle_length: int = 28, period_length: int = 5) -> dict:
"""
Predict next period and fertile window based on cycle data.
Ovulation assumed at cycle_length - 14 days (luteal phase = 14 days).
"""
ovulation_day = cycle_length - 14
next_period = last_period + timedelta(days=cycle_length)
ovulation_date = last_period + timedelta(days=ovulation_day)
fertile_start = ovulation_date - timedelta(days=5)
fertile_end = ovulation_date
return {
"last_period": last_period.strftime("%Y-%m-%d"),
"next_period": next_period.strftime("%Y-%m-%d"),
"ovulation_date": ovulation_date.strftime("%Y-%m-%d"),
"fertile_window": f"{fertile_start.strftime('%Y-%m-%d')} to {fertile_end.strftime('%Y-%m-%d')}",
"period_ends": (last_period + timedelta(days=period_length - 1)).strftime("%Y-%m-%d"),
}
result = menstrual_cycle(date(2025, 3, 1), cycle_length=28, period_length=5)
print(f"Last Period : {result['last_period']}")
print(f"Period Ends : {result['period_ends']}")
print(f"Fertile Window : {result['fertile_window']}")
print(f"Ovulation : {result['ovulation_date']}")
print(f"Next Period : {result['next_period']}")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.