Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic syntax
#1
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 !!
Reply
#2
(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?
buran likes this post
« We can solve any problem by introducing an extra level of indirection »
Reply
#3
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.
buran likes this post
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020