We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
List comprehensions are a super cool part of python.
# example# You can use a loop to create a listsquares=[]forxinrange(10):squares.append(x**2)printsquares[0,1,4,9,16,25,36,49,64,81]# Or you can use list comprehensions to get the same result:squares=[x**2forxinrange(10)]printsquares[0,1,4,9,16,25,36,49,64,81]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 0: Mean, Median, and Mode
You are viewing a single comment's thread. Return to all comments →
take out the square brackets [] from around the list() call. It will already return a list and asign it to the numbers variable.
It is expecting valid list comprehension syntax.
List comprehensions are a super cool part of python.