Solving Star Pattern program in Python