The function below takes a single input, containing list of strings. This function should return string containing an HTML unordered list with each of in_list strings as a list item. For example, if provided the list ['CS 105', 'CS 125', 'IS 206'], your function should return a string containing the following. The only whitespace that is important is those contained in the given strings (e.g., the space between CS and 105).

Respuesta :

The following code will be used to calculate the given requirement.

Explanation:

This function will return string containing an HTML unordered list with each of in_list strings as a list item

def make_html_unordered_list(in_list):

   result = '<ul>\n'

   for item in in_list:

       result += '<li>' + item + '</li>\n'

   return result + '</ul>'

# Testing the function here. ignore/remove the code below if not required

print(make_html_unordered_list(['CS 105', 'CS 125', 'IS 206']))

Note: The only whitespace that is important is those contained in the given strings.

The program is an illustration of loops.

Loops are used to perform repetitive and iterative operations.

The function in Python where comments are used to explain each line s as follows:

#This defines the function

def make_html_unordered_list(in_list):

   #This creates the opening tag of an HTML unordered list

   result = '<ul>\n'

   #This iterates through the list

   for item in in_list:

       #This creates the unordered list, without the last closing tag

       result += '<li>' + item + '</li>\n'

   #This returns the unordered list, with the last closing tag

  return result + '</ul>'

Read more about similar programs at:

https://brainly.com/question/14282285

ACCESS MORE