Pregunta de entrevista de Cognizant

basic questions in python and java. pattern printing