The program determines which year is leap.

User enters a value, gets an answer, then the primary question should loop: "Which year ?:".

I can not loop it, tell me what am I doing wrong?


year = int(input("Which year?: ")) while True: if year % 4 != 0 or (year % 100 == 0 and year % 400 != 0): print("usual year") else: print("intercalary year") break 
  • one
    Well, put it inside the loop. What are the difficulties? - andreymal pm
  • @andreymal not really understand you, what do you mean? - Alexandr S
  • 3
    Obviously, to loop something, it must be something inside the loop. If you want to loop a question, place it inside the loop. What problems? - andreymal
  • @andreymal you are a genius !!!!! Thank! - Alexandr S
  • Leap year - leap year. Intercalary year in our time does not exist and is hardly ever when it was in the history of mankind. But there is an intercalary day, this is the day that is inserted to align the calendar. February 29th. Read further . - Enikeyschik

1 answer 1

 while True: year = int(input("Which year?: ")) if year % 4 != 0 or (year % 100 == 0 and year % 400 != 0): print("usual year") else: print("intercalary year") break