• + 0 comments

    My python code I know my algorythm is kinda trash, but it works efficiently I guess... Pwese don't tell me to use map()

    from datetime import datetime
    import math
    
    zwrocona = input().split()
    doKiedy = input().split()
    
    def kara(zwrocona, doKiedy):
        Dz = int(zwrocona[0])
        Mz = int(zwrocona[1])
        Rz = int(zwrocona[2])
        Dk = int(doKiedy[0])
        Mk = int(doKiedy[1])
        Rk = int(doKiedy[2])
        
        date1 = datetime(Rk, Mk, Dk)
        date2 = datetime(Rz, Mz, Dz)
        
        diff1 = date2 - date1
        
        diff = diff1.days
        
        if diff <= 0:
            return 0
        elif Mz == Mk and Rz == Rk:
            return diff * 15
        elif Rz == Rk and Mz != Mk:
            return math.floor(diff/30) * 500
        elif Rz != Rk:
            return 10000
        
    if len(zwrocona) == 3 and len(doKiedy) == 3:
        print(kara(zwrocona, doKiedy))