I need to convert this VBA code into python. The code in vba form is as the following:
Function Findit(x As Integer, y As Integer, z As Integer) As Integer
Findit = x + y + z
If (y = x) Then
Findit = y
If (y < z) Then
Findit = z
EndIf
If (Findit <> x) Then
Findit = y
EndIf
Else
If (z = Findit) Then
Findit = y
Findit = x
EndIf
EndIf
End Function
So what I did is walked through line by line and tried to do the indentation correctly because I know it matters in Python. My temptation is as the following:
def Findit_f(x, y, z):
Findit = x + y + z
if x == y:
Findit += y
if y < z:
Findit += z
elif Findit != x:
Findit += y
else:
if z == Findit:
Findit += x
Findit += y
return Findit
But there is not a way to check if it is true or not. There is not really an error but that is the case and I need someone to verify my work with an explanation (if there is an error) so I could understand what is going on! I'm new to python and that's why I'm struggling. Also, is there any way to check if I'm doing it correctly or not? like printing a value or something. Because I tried that but once I run the code there is no error and also there is no results. It just seem to be running successfully but I'm not sure if I met the criteria of the VBA code in python. Thank you again and sorry for any confusion! if there is something that needed to be clarified just let me know! Thank you!