Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Lists Creating lists

George Lugo
seal-mask
.a{fill-rule:evenodd;}techdegree
George Lugo
Python Web Development Techdegree Student 922 Points

my code is still not working for some weird reason

def my_list[4,2,8,'John','george',[1,2]]

lists.py
def my_list[4,2,8,'John','george',[1,2]]

George Lugo

This is your 3rd question now for the same challenge within an hour or two. Others have tried to help you on your previous questions.

Are you reading those responses? Are you having trouble replying back to your original question to indicate that you need more help?

1 Answer

Hi George,

If you delete the def keyword and then assign your list to my_list using an equals sign, that'll work fine.

Something like:

my_list = [ ... ] // your list looks fine

Steve.

Note: You have to use a hash sign/pound sign # to make a comment in Python. In many other languages, you use // to make comments.

Yep. Fair 'comment'! Not sure how I managed to get that wrong since I've been writing in Ruby on Rails all day. Maybe I was wishing I was back in Java-land. :wink:

Cheers,

Steve. :+1:

Haha. I'm probably almost the opposite; I'm familiar with Python (not 100% familiar with Ruby but pretty familiar) and new to Java.

At risk of getting the thread off-topic (Sorry, George, I hope you got this sorted in the end!), I've never used Python at all. My background is C++ & (the amazing) Smalltalk and then, more latterly, Java & RoR. I must branch out more, though. Although I find Rails very satisfying in getting big jobs done elegantly.

Cool! My first language I ever learned was Python. I learned it before Treehouse so when I joined Treehouse I was somewhat familiar with Python (and a little of Ruby and JS as well). When I joined Treehouse, I boosted my programming skills (Treehouse is incredibly amazing at teaching! :smile:). Meanwhile, I was learning PyGame on my own because I loved video games so much. I found is wonderful; then in the future Treehouse released a new topic: Game Development. I was so exited, of course. I went into that topic and learned Unity3D. It was a very exciting adventure on Treehouse :)

Let's chat off this thread! I have various contact methods in my profile. :+1: