error: syntax error, unexpected 'and'
I have run the following python program program3.py by codon.
class g32Ck29 ():
l618xA2v = "IXgotDE13"
JR2F7RH5o = "r"
ZPs35284 = 0.5
vggx3vQ3 = 0.31
def Q0400A8 ( self , M1595y67A : int , Zxd3V4Yw : int , wxUjz87u : int ) -> bool :
if (((self.l618xA2v)==None)and(self.JR2F7RH5o)==("V_J9S2w_UA")) :
self.ZPs35284+=self.vggx3vQ3
if name == 'main':
u3hZC2EfI = 2564
s05PK59Exs = 1522
PYMX80c = 7030
OAD7y28949= g32Ck29();
OAD7y28949.Q0400A8(u3hZC2EfI,s05PK59Exs,PYMX80c)
print(OAD7y28949.ZPs35284)
And it output error message as follow: codon_program3.py:7:31: error: syntax error, unexpected 'and'
I hava run it by both python3 and pypy3 and output the following content: 0.5
The related files can be found in https://github.com/starbugs-qurong/python-compiler-test/tree/main/codon/python_3
@starbugs-qurong Same as in #322, and you have to use type hint Optional[str], if class member l618xA2v is going to be None.
class g32Ck29:
l618xA2v: Optional[str] = "IXgotDE13"
Same as in #322 , spaces must be added before and after the keyword "and". I have roughly read the rules of Whitespace in Expressions and Statements in PEP 8 and didn't find the explanation of “or” and "and".
@starbugs-qurong Duplicate of #317
@starbugs-qurong See PEP 8 -> Whitespace in Expressions and Statements -> Other Recommendations.
Always surround these binary operators with a single space on either side: assignment (=), augmented assignment (+=, -= etc.), comparisons (==, <, >, !=, <>, <=, >=, in, not in, is, is not), Booleans (and, or, not).