Resolving a complex if statement comparing multiple variables

Hey all, I’m having some issues with a particularly complex piece of testing.

The error I’m getting (when I run randomtest) is this: ‘Error: chapter_6_champagne_and_conquests line 1486: Invalid expression at char 98, expected CLOSE_PARENTHESIS, was: OPERATOR [+]’

My code looks like this:

*elseif ((((((player_in) and (rupert_in)) and (thiemo_in)) and (nalani_in)) and (player_sum + rupert_sum + thiemo_sum + nalani_sum = player_sum*4)) and (player_sum > 0))>

Any ideas how to fix this? Thanks!

You seem to have > at the end, which is out of place…?

You also can’t have continous mathematical operation such as:

*if answer = a + b + c
   then correct

Chunk them out so a paren is one operation. Here’s to visualize how a set of parenthesis is used

*if ( (answer) = (a +(b +c)) )

The way I learned to handle these were to think of them in pairs.


Is there anything after > ? It is supposed to.

Thanks Szaal! It was the grouping of individual operations that solved it. Cheers!


This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.