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 Introducing Lists Meet Lists Creation

How do I make a stupid square bracket!

Can someone help me!? How do I do a square bracket!!!

Michael Hulet
Michael Hulet
47,913 Points

Hey Dylan! I understand you're frustrated, and that's ok, but please refrain from using profanity in the Community

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! In addition to the answer left above, if you are attempting to use a square bracket in the console provided with the workspace, and you are not working with a US keyboard, then you will need to do something different here. If you are not working from a Windows system, you will need to temporarily change your keyboard to be that of a US keyboard as otherwise, the key mappings will be off.

However, if you are working from a Windows system, you have another option called "Alt codes". This technique also requires that you have a number pad on your keyboard as it will not work with the numbers along the top of your keyboard. Holding down alt and pressing 9 and then 1 will result in the open square bracket [ while holding alt and then pressing 9 and 3 will result in the closing square bracket ].

You can find a complete list of alt code here: https://www.alt-codes.net/

Hope this helps! :sparkles:

Sondre Fjellving
Sondre Fjellving
4,700 Points

This sure helped me. Thanks for taking your time to share this! It made my life a lot easier hahaha. Good day to you :))

Simon Bazso
Simon Bazso
1,162 Points

I have the same issue and then alt codes doesnt seem to work in the workspace enviorment, only outside. Just as my normal hard braclets would work. Any tip? Cant even copy paste even though that would be an extremly painful way.

[ ] <-- Could copy and paste after googling square bracket (opening and closing).

Just a quick heads-up, on macOS Mojave v10.14.6 with a French Canadian keyboard, the square brackets are alt-option + 9 for [ and 0 for ] but it only works in the file editor, not in the console.

When I hit alt-option + 9 or 0 for the [], the console automatically writes (arg: followed by either key I tapped.

I wish I could upload a video to explain this better.. but it's strange. Maybe this is a bug?

Thank you!