Ask Question
8 December, 08:09

Problem 1: Create a list that contains the months of the year. Problem 2: Create a loop to print the month number and name (do not hard code the month number)

+4
Answers (1)
  1. 8 December, 08:58
    0
    Program for problem 1:

    Month_name=['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] # List which holds the month name.

    Program for problem 2:

    Month_name=['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] # List which holds the month name.

    for x in range (0,12) : # loop which is used to print the name and number of the month.

    print (str (x+1) + " "+Month_name[x]) # It will print the number and month name.

    Output of problem 1:

    The program for problem 1 has no output because it has no print statement.

    Output of problem 2:

    The above program will print all the months with their number in which the first text will print the number of the month and the second text will print the name of the month.

    Explanation:

    Missing information:

    "Design the program for problem 1 and problem 2" is missing on the above question.

    Detailed Explanation:

    The above program is in python language in which the first line creates a list of the names of the months. Then the "for loop" is used to print the number and name of the program. In this "for loop", the list index is printed by adding 1 on it with the value which is the name of the month. It is because the list starting index value is 0 and the ending index value is size-1.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Problem 1: Create a list that contains the months of the year. Problem 2: Create a loop to print the month number and name (do not hard ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers