Pregunta de entrevista de Porter

Mostly sql queries and python code to print triangle