Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- print("-------------------------------RESTART---------------------------------")
- day = input("Δώσε τον αριθμό που αντιστοιχεί στην ημέρα της ημερομηνίας:")
- day = int(day)
- month = input("Δώσε τον αριθμό που αντιστοιχεί στο μήνα της ημερομηνίας:")
- month = int(month)
- year = input("Δώσε τον αριθμό που αντιστοιχεί στο έτος της ημερομηνίας:")
- year = int(year)
- year2 = (year % 4)
- year2 = int(year2)
- year3 = (year % 400)
- year3 = int(year3)
- condition1 = 0
- condition1 = int(condition1)
- condition2 = 0
- condition2 = int(condition2)
- if (year2 == 0) and ((year % 100) != 0):
- condition1 = 1
- condition1 = int(condition1)
- if (year % 400) == 0:
- condition2 = 1
- condition2 = int(condition2)
- if (day < 1) or (day > 31): # and((year%4)==1)
- print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
- elif (month > 12) or (month < 1):
- print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
- elif ((day == 29) and (month == 2)) and ((condition1 == 1) or (condition2 == 1)):
- print("Η ημερομηνία " + str(day) + "/" + str(month) + "/" + str(year) + " " + "είναι έγκυρη")
- elif ((day == 29) and (month == 2)) and ((condition1 == 0) or (condition2 == 0)):
- print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
- elif (day == 31) and ((month == 2) or (month == 4)) or (month == 6) or (month == 9) or (month == 11):
- print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
- else:
- print("Η ημερομηνία " + str(day) + "/" + str(month) + "/" + str(year) + " " + "είναι έγκυρη")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement