Use `#{Formula[python].prefix}/Frameworks/Python.framework/Versions/#{version}` outside the if and set it as a variable as it's the same for both.