Вопрос задан 20.09.2018 в 04:18. Предмет Информатика. Спрашивает Borisov Maks.

Составить программу которая по номеру месяца выводит его название

0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Прохоров Илья.
Я написал 1-4 класы урок биографика но в 1-4 нет биографики
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Program to Display Month Name Based on Month Number

Here is a program in Python that takes a month number as input and displays its corresponding month name:

```python def get_month_name(month_number): month_names = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] if month_number >= 1 and month_number <= 12: return month_names[month_number - 1] else: return "Invalid month number"

month_number = int(input("Enter the month number (1-12): ")) month_name = get_month_name(month_number) print("Month name:", month_name) ```

In this program, we define a function `get_month_name()` that takes a month number as an argument. The function uses a list of month names and returns the corresponding month name based on the input month number. If the input month number is not within the range of 1-12, the function returns "Invalid month number".

We then prompt the user to enter a month number and call the `get_month_name()` function to get the month name. Finally, we print the month name.

Please note that this program assumes the user will enter a valid month number between 1 and 12. If an invalid month number is entered, the program will display "Invalid month number".

I hope this helps! Let me know if you have any further questions.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос