Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.31 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. print("-------------------------------RESTART---------------------------------")
  4. day = input("Δώσε τον αριθμό που αντιστοιχεί στην ημέρα της ημερομηνίας:")
  5. day = int(day)
  6. month = input("Δώσε τον αριθμό που αντιστοιχεί στο μήνα της ημερομηνίας:")
  7. month = int(month)
  8. year = input("Δώσε τον αριθμό που αντιστοιχεί στο έτος της ημερομηνίας:")
  9. year = int(year)
  10. year2 = (year % 4)
  11. year2 = int(year2)
  12. year3 = (year % 400)
  13. year3 = int(year3)
  14. condition1 = 0
  15. condition1 = int(condition1)
  16. condition2 = 0
  17. condition2 = int(condition2)
  18.  
  19.  
  20. if (year2 == 0) and ((year % 100) != 0):
  21.     condition1 = 1
  22.     condition1 = int(condition1)
  23. if (year % 400) == 0:
  24.     condition2 = 1
  25.     condition2 = int(condition2)
  26.  
  27. if (day < 1) or (day > 31):  # and((year%4)==1)
  28.     print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
  29. elif (month > 12) or (month < 1):
  30.     print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
  31. elif ((day == 29) and (month == 2)) and ((condition1 == 1) or (condition2 == 1)):
  32.     print("Η ημερομηνία " + str(day) + "/" + str(month) + "/" + str(year) + " " + "είναι έγκυρη")
  33. elif ((day == 29) and (month == 2)) and ((condition1 == 0) or (condition2 == 0)):
  34.     print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
  35. elif (day == 31) and ((month == 2) or (month == 4)) or (month == 6) or (month == 9) or (month == 11):
  36.     print("Δεν υπάρχει μέρα που να αντιστοιχεί στον αριθμό" + " " + str(day) + " " + "του μήνα " + " " + str(month) + " " + "για τον χρόνο" + " " + str(year))
  37. else:
  38.     print("Η ημερομηνία " + str(day) + "/" + str(month) + "/" + str(year) + " " + "είναι έγκυρη")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement