I don’t know why the print isn’t working, as I cannot see the error message in your screenshot.
You could post an executable code snippet by wrapping in into three backticks ```, in case you get stuck.
This would allow us to copy-paste the code and debug it easily, which is not possible with unformatted source code or screenshots.