'Print black triangle on white image using python

Using loops to draw a black triangle as foreground(dimensions specified) in a White Image (Input: A plain White Image. Output: An image having white as background and Black triangle of specific size as foreground).

I am new to python and found this question online. I have searched but I am unable to find a good solution for this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source