Ask Question
8 October, 20:34

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)

+5
Answers (1)
  1. 9 October, 00:14
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers