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

Create a list variable named list_2 that has three completely different items.

Create a list variable named list_2 that has three completely different items.

Can you post the code you currently have so we can provide feedback? This post has some good tips for formatting code on the forum.

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Let's break the question down and go step by step.

Step 1: Create a list variable named list_2 that has three completely different items

To create a list variable named "list_2", type the name of the variable followed by "=" followed by square brackets as shown below:

list_2 = []

Step 2: Create a list variable named list_2 that has three completely different items

Lists can contain any Python object. To include multiple objects, type them between the square bracket separated by commas. The list below contains a string, an integer, and an empty Python dict:

list_2 = ["Hello", 5, {}]
Avi Barit
seal-mask
.a{fill-rule:evenodd;}techdegree
Avi Barit
Front End Web Development Techdegree Student 5,236 Points

Hi Sibusiswe . I think this should do it:

list_2 = [12,"agent",True]

This list then has three types of variables: integer, string and boolean.