What's new

Help PYTHON

KilleerR8

Elite
Joined
Mar 16, 2018
Posts
953
Solutions
1
Reaction
740
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.png
 

Attachments

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()
 
Last edited:
Top