Question

How to do this code?

HW13.11. Create an HTML list from a Python list The function below takes one parameter: a list, that contains only strings. C

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Source Code:

def create_html_list(data):
   html_list=""
   html_list+="<ul>"
   for i in data:
       html_list+="<li>"+i+"</li>"
   html_list+="</ul>"
   return html_list

print(create_html_list(["one","two"]))

3 main.py 1. def create_html_list(data): 2 html_list= html_list+=<ul> 4 for i in data: html_list+=<li>+i+</li> html_l

Add a comment
Know the answer?
Add Answer to:
How to do this code? HW13.11. Create an HTML list from a Python list The function...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In oython 3. HTML supports ordered and unordered lists. An ordered list is defined using element ol and each item of th...

    In oython 3. HTML supports ordered and unordered lists. An ordered list is defined using element ol and each item of the list is defined using element li. An unordered list is defined using element ul and each item of the list is defined using element li as well. For example, the unordered list in file w3c html is described using HTML code ul> <li>Web for All</li> <li>Web on Everything</li> </ul- Develop class ListCollector as a subclass of HTML Parser...

  • HW7.26. Return a CSV string from a list of numbers The function below takes a single...

    HW7.26. Return a CSV string from a list of numbers The function below takes a single parameter, a list of numbers called number_list. Complete the function to return a string of the provided numbers as a series of comma separate values (CSV). For example, if the function was provided the argument [22, 33, 44], the function should return '22,33,44'. Hint: in order to use the join function you need to first convert the numbers into strings, which you can do...

  • [Python] I have the following function that removes all non-numerical characters from a string: d...

    [Python] I have the following function that removes all non-numerical characters from a string: def remove_non_numeric(s):    seq_type= type(s) return seq_type().join(filter(seq_type.isdigit, s)) And I need help implementing it into this function: def list_only_numbers( a_list ) : # Create a new empty list. # Using a loop (or a list comprehension) # 1) call remove_non_numeric with a list element # 2) if the return value is not the empty string, convert # the string to either int or float (if it contains...

  • Python 3.7.3 ''' Problem 3 Write a function called names, which takes a list of strings...

    Python 3.7.3 ''' Problem 3 Write a function called names, which takes a list of strings as a parameter. The strings are intended to represent a person's first and last name (with a blank in between). Assume the last names are unique. The function should return a dictionary (dict) whose keys are the people's last names, and whose values are their first names. For example: >>> dictionary = names([ 'Ljubomir Perkovic', \ 'Amber Settle', 'Steve Jost']) >>> dictionary['Settle'] 'Amber' >>>...

  • IN PYTHON CODE Question #1 Write a function capital that has one argument: strlist that is...

    IN PYTHON CODE Question #1 Write a function capital that has one argument: strlist that is a list of non-empty strings. If each string in the list starts with a capital letter, then the function should return the value True. If some string in the list does not start with a capital letter, then the function should return the value False You may use any of the string functions that are available in Python in your solution, so you might...

  • python Create an empty list of size 100 × 200 with all zeroes. How do you...

    python Create an empty list of size 100 × 200 with all zeroes. How do you access the 4th row and 2nd column of a 2D list called Write a function called printList that takes as a parameter a 2D list and prints it to screen in row/column format. Create a multiplication table of size 10 × 10 that has all the products from 1 times 1 all the way up to 10 times 10. Create a 2D list (matrix)...

  • PYTHON The function longest that returns the longest of two strings. The function count_over that takes...

    PYTHON The function longest that returns the longest of two strings. The function count_over that takes a list of numbers and an integer nand returns the count of the numbers that are over n. The function bmi that takes two parameters height and weight and returns the value of the body mass index: a person's weight in kg divided by the square of their height in meters. def longest(string1, string2): """Return the longest string from the two arguments, if the...

  • language is python Write a function named subsetStrings that has two inputs, a list of strings...

    language is python Write a function named subsetStrings that has two inputs, a list of strings and an integer n. Your function should use a single list comprehension to create a new list containing the first n characters of each string in the input list if the length of the individual string is at least n (strings that are too short should be skipped). Your function should return the new list ex: inputList 'Frederic, 'powerade', 'spring break, 'pen'] and n-4...

  • The function below takes a single argument: data_list, a list containing a mix of strings and...

    The function below takes a single argument: data_list, a list containing a mix of strings and numbers. The function tries to use the Filter pattern to filter the list in order to return a new list which contains only strings longer than five characters. The current implementation breaks when it encounters integers in the list. Fix it to return a properly filtered new list. HW10.8. Fix code to filter only strings of a certain list from a collection The function...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT