sorry, I really don't have the time nor the will to delve in raycasting project right now. but I can point you to some useful resources that may help you in your project:
here is a good raycasting engine with floor and ceiling that work very well, there's even shadow implemented and it is derived from the permadi tutorial I believe, it is written in java script but you can easily port it to python:
https://github.com/permadi-com/ray-cast/tree/master/
here is other good raycasting tutorials with code and explanation:
https://dev.opera.com/articles/3d-games-with-canvas-and-raycasting-part-1/
https://www.playfuljs.com/a-first-person-engine-in-265-lines/
hope it help.