Q. Rewrite the following code in python after removing all syntax error(s).

Underline each correction done in the code.


30 = To
for K in range(0, To)
    IF K%4 == 0:
        print (K* 4)
    Else:
        print (K + 3).

Answer :-

To = 30  # variable name should be on LHS
for K in range(0, To) :  # : was missing
    if k%4 == 0:  # it should be in lower case
        print (K* 4)
    else:  # else should be in lower case
        print (K + 3).

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post