Getting "Not a statement" error

Full disclosure, this voting smart contract was generated by Copilot. Consider the source. In this function
@sp.entry_point
def vote(self, param):
sp.cast(param, sp.record(delegator=sp.string,vote=sp.string))
assert self.data.votes.contains(param.delegator)
if param.vote == “yay”:
self.data.votes[param.delegator].yay += 1
elif param.vote == “nay”:
self.data.votes[param.delegator].nay += 1

I am getting this error when running: “File “”, line 20
SyntaxError: Not a statement: if param.vote == “yay”:”

Was unable to find an answer in the forum or in the online guides or examples

SmartPy doesn’t support elif:

Try it like this:

import smartpy as sp

@sp.module
def main():
    vote_type: type = sp.map[sp.string, sp.record(yay=sp.nat, nay=sp.nat)]
    class MyContract(sp.Contract):
        def __init__(self):
            self.data.votes = {
               "Sam": sp.record(yay=sp.nat(0), nay=sp.nat(0)),
               "Sarah": sp.record(yay=sp.nat(0), nay=sp.nat(0)),
               "Hank": sp.record(yay=sp.nat(0), nay=sp.nat(0)),
            }
            sp.cast(self.data.votes, vote_type)

        @sp.entrypoint
        def vote(self, param):
            sp.cast(param, sp.record(delegator=sp.string, vote=sp.string))
            assert self.data.votes.contains(param.delegator)
            if param.vote == "yay":
                self.data.votes[param.delegator].yay += 1
            if param.vote == "nay":
                self.data.votes[param.delegator].nay += 1


@sp.add_test()
def test():
    scenario = sp.test_scenario("test", main)
    scenario.h1("Voting test")
    c1 = main.MyContract()
    scenario += c1
    c1.vote(sp.record(
        delegator= "Sam",
        vote= "yay",
    ))
    scenario.verify(c1.data.votes["Sam"].yay == 1)

Appreciate the quick response! That fixed it. I figured something generated by Copilot or Chatgpt would would need some tweaking.