Cognizant interview question

basic questions in python and java. pattern printing