4daJKong
4daJKong

Reputation: 2045

How to write comment behind text in one line if this sentence is divided into many lines?

There is a simple example, actually statement is too long to write in one line, and I have to write some necessary comment in each line, but when I add \ and #, it shows error here, how to solve this problem?

   a, b, c = 1,2,3 
    if a > 10 \ #add element a
    or b > 10 \ #add element b
    or c > 10: #add element b
        print("good")

Upvotes: 1

Views: 36

Answers (1)

Brinfer
Brinfer

Reputation: 437

Just put this in bracket.

a, b, c = 1,2,3
if (a > 10 #add element a
or b > 10  #add element b
or c > 10): #add element c
    print("good")

Upvotes: 4

Related Questions