
3. Определить, является ли год, который ввел пользователем, високосным или обычным. (4)


Ответы на вопрос

Решение:
Python
year = int(input())
if year == 365:
print('Обычный.')
else:
print('Високосный.')



Determining if a Year is Leap or Common
To determine if a year is leap or common, we need to consider the rules for leap years. In the Gregorian calendar, which is the most widely used calendar system today, the following rules apply:
1. A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
Based on these rules, we can write a simple algorithm to determine if a year is leap or common.
Here's an example in Python:
```python def is_leap_year(year): if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: return True else: return False else: return True else: return False ```
You can use this function by passing the year as an argument, and it will return `True` if the year is a leap year, and `False` if it is a common year.
For example:
```python print(is_leap_year(2020)) # Output: True print(is_leap_year(2021)) # Output: False print(is_leap_year(2000)) # Output: True print(is_leap_year(1900)) # Output: False ```
Please note that this algorithm is based on the Gregorian calendar rules. Different calendar systems may have different rules for determining leap years.
Example sources: - Source - snippet: ``, , , ... , , 4 (. - Source - snippet: `... , ; ...``


Похожие вопросы
Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili