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) Sets Out Of This Word Game

Why are we using semicolon in the code?

The instructor added a semicolon after the following statement. But the output is same even without using a semicolon.


So why are we using semicolon here? Please advise. Thanks

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi ARCHIT RANA

Craig teaches both Python and Java here on Treehouse. Like all of us... occasionally one syntax kind of slips into the other language, and Java uses semi-colons to end statements.
While Python does let you use semi-colons to denote an end of a statement, it is not needed or common practice. So, no need to worry about or remember the stray semi-colon in the video, but this is why both work the same.

So, while I can't say for sure, I'm going to guess that Craig Dennis simply had a bit of a Java hiccup. Lol. :smirk:

Keep Coding! :) :dizzy:

Craig Dennis
Craig Dennis
Treehouse Teacher

Old habits die hard ;) Thanks Jason, and yes...just a typo that luckily didn't cause a problem.

Hai Phan
Hai Phan
2,442 Points

This is not relevant but I really like how you use icons like this :dizzy:. Can you tell me where I can find these?

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hi Hai Phan

The Treehouse Community utilizes Markdown in the posts. Using markdown, you can make :question: become :question:.

The list of the markdown emoji markup is hosted here on GitHub.

Hope this helps!!

Keep coding! :dizzy:

Hai Phan
Hai Phan
2,442 Points

Thank you so much :thumbsup: