I'm writing a program that compares two indexes in a string, and returns either True or False depending on if the indexes have the same value. It's also supposed to return false if either of the indexes is outside of the string, but I cant figure out how to move forward without just getting an error message. Here's what I have so far:
def samat(jono,a,b):
if jono[a] in jono and jono[b] in jono:
return (jono[a]==jono[b])
if __name__ == "__main__":
print(samat("koodari", 1, 2))