Help me in solving PYTH12 problem

My issue

My code

print ("3+4) "and" (2+1")
print ((7,:"and", 3))

Learning course: Learn Python
Problem Link: CodeChef: Practical coding for everyone

The question states that we have to directly print results for β€œ3+4” and β€œ2+1”. The desired solution should be print(7, β€œand”, 3) .

In your case, the first code , the second line is almost correct, although why is there is semicolon after first comma?

The first code seems all wrong. It would have printed (3+4) as a string, not calculated the values as integers if you intended to write it like;
print(β€œ3+4”,β€œand”,β€œ2+1”).

1 Like