Your first issue is that you are comparing a string (rev) with an int (n) for equality. You'll need to change one to the other.
An extra hint: your list slice is not doing what you think it is. I'd recommend you trying experimenting with list slices to figure out how they work properly.
Here is your answer:
PS: Your if statement wasn't working as expected. I changed it so the code works. One of problems was comparing rev(str) and n(int)