🔒 Closed PYTHON

Status
Not open for further replies.

KilleerR8

Eternal Poster
Pa-help naman po mga ka-phcorner. Hindi ko magawa ung magcacalculate ng total number ng holidays. Eto palang ung code na nagagawa ko pa-help po


277031408_551150192921452_8045169144013042908_n.png
275910179_1609327629445484_8015777477609398455_n.jpg
Python:
import holidays
import calendar
from datetime import date

stmonth = int(input("Please enter starting month: "))
stday = int(input("Please enter starting month day: "))
styear = int(input("Please enter starting year: "))

print("1-Yes")
print("2-No")
lyear = int(input("Is the starting year a leap year?: "))
   
submonth = str(input("Please enter ending month: "))
subday = int(input("Please enter ending day: "))
endyear = date = int(input("Please enter ending year: "))

277031408_551150192921452_8045169144013042908_n.webp
 
Sana all nakapag python na samantalang samin dati HTML, CSS, JS, at may kunting C# lang. Mas advance pala sa school nyo TS
Naku advance nga pero ung teacher naman namin walang pakialam bigay lang nang bigay ng activity saamin hindi manlang nagtuturo hahaha
 
Suggest lang, once masolve mo na first solution mo, you should check programmatically the year if a leap year.

Python:
# https://docs.microsoft.com/en-us/office/troubleshoot/excel/determine-a-leap-year
def is_leap_year(year: int) -> bool:
    year = int(year)

    if not year % 4 == 0:
        print(f'{year} is not a Leap Year')
        return False

    print(f'{year} is a Leap Year')

    print('divisible by 4')

    if year % 100 == 0:
        print('and divisible by 100')
    else:
        print('and not divisible by 100')

    if year % 400 == 0:
        print('But also divisible by 400')

    return True


for year in (1990, 2000, 2021, 2024):
    is_leaf_year(year)
    print()
 
Status
Not open for further replies.

About this Thread

  • 10
    Replies
  • 736
    Views
  • 4
    Participants
Last reply from:
Kr4mG3L0

Trending Topics

Online now

Members online
1,137
Guests online
3,847
Total visitors
4,984

Forum statistics

Threads
2,308,706
Posts
29,186,765
Members
1,191,173
Latest member
HRMU2025
Back
Top