I am trying to convert a Python program into C#. I do not understand what is being done here.
def mrF(alg, times = 1):
if ((times % 2) == 0):
return alg
else:
if (alg == 'R'):
return "L'"
if (alg[0] == 'G'):
return alg
if (alg[-1] == "'"):
return alg[:-1]
elif (alg[-1] == '2'):
return alg
else:
return (alg + "'")
Is alg a string or a string array or a list?
Its a string. You can use a subscript operator on strings in Python, which I assume is the only part in your code, that made you to post it as question.
Its similar to the way you access indices in
lists.