Python Forum
Basic syntax - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Basic syntax (/thread-41446.html)



Basic syntax - zenkalidas - Jan-17-2024

sorry if this seems too basic . What is wrong with the following statement : if (a1_1 + a1_2 + a1_3 + a1_4 + a1_5 + a1_6 == 6) and (a2_1 + a2_2 + a2_3 + a2_4 + a2_5 + a2_6 == 5) : I am getting invalid syntax error.
Thanks in advance !!


RE: Basic syntax - Gribouillis - Jan-17-2024

(Jan-17-2024, 07:40 PM)zenkalidas Wrote: I am getting invalid syntax error.
If you are getting a syntax error, it means that the error message written by Python tells you exactly where the syntax error occurs, so can you post the complete error message sent by Python?


RE: Basic syntax - deanhystad - Jan-17-2024

You probably should not be writing code that looks like that. Are the a1 values related in some way? Would a list be a better way to group the values than making several variables with similar names?

I ran your code and don't get a syntax error.