I can join lines in Python using semi-colon, e.g.
a=5; b=10
But why can\'t I do the same with for
x=[\'a\',\'b\']; for i,j
A compound statement consists of one or more ‘clauses’. A clause consists of a header and a ‘suite.’ The clause headers of a particular compound statement are all at the same indentation level. Each clause header begins with a uniquely identifying keyword and ends with a colon. A suite is a group of statements controlled by a clause. A suite can be one or more semicolon-separated simple statements on the same line as the header, following the header’s colon, or it can be one or more indented statements on subsequent lines.
x=['a','b'];
This does not justify the clause definition and thus cannot be used as a part of a compound statement. Therefore you encounter error.