The output from wc is a string; it can never be equal to an integer. You can convert it, or compare to '1', but this is all a useless use of wc anyway.
A better approach altogether would be to run just the rpm command as a subprocess, and check its output with a simple native Python snippet.
import subprocess
if 'XY' in subprocess.check_output(['rpm', '-qa']):
print('XY is installed')
This is somewhat prone to false positives, because you are checking if any part of the output contains 'XY' as a substring anywhere. If you have libXY-dev or ABCXYZ installed, it will incorrectly claim that you have XY. It would probably be better to query RPM for the status of this particular package only; but hopefully this should at least get you started.
Perhaps also notice how this avoids a shell which is always a win, especially if you are not too familiar with the shell and its pitfalls.