I think there is a small error in the ‘Creating Dictionaries’ quiz in the Computer Science Path. The question asks which of the options is the syntax for creating an empty list, but every option has a semicolon at the end of the line, like in JavaScript. This doesn’t look to be the right syntax in Python (unless I’ve missed something in the previous lessons). Can someone please take a look?
While they are hardly ever used, semi-colons are still valid syntax in Python.
In Python, semicolons can be used to separate multiple statements that are placed on the same line, however this may make the code cumbersome to read.
>>> sq = lambda x: x ** 2; print(sq(7)); print(sq(8)); print(sq(9))
49
64
81
1 Like
Love your example, Glenn. Well chosen, and it makes a good point.
1 Like
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.