from termcolor import colored
# The South African flag colors, approximated
colors = {
'black': 'on_grey',
'yellow': 'on_yellow',
'green': 'on_green',
'blue': 'on_blue',
'red': 'on_red',
'white': 'on_white'
}
# The flag as a 2D list, simplified
flag = [
['red', 'red', 'white', 'blue', 'blue'],
['red', 'red', 'white', 'blue', 'blue'],
['white', 'white', 'green', 'white', 'white'],
['black', 'black', 'yellow', 'black', 'black'],
['white', 'white', 'green', 'white', 'white'],
['blue', 'blue', 'white', 'red', 'red'],
['blue', 'blue', 'white', 'red', 'red'],
]
# Print each color block with the right color background
for row in flag:
for color in row:
print(colored(' ', 'grey', colors[color]), end='')
print()
from termcolor import colored
# The South African flag colors, approximated
colors = {
'black': 'on_grey',
'yellow': 'on_yellow',
'green': 'on_green',
'blue': 'on_blue',
'red': 'on_red',
'white': 'on_white'
}
# The flag as a 2D list, simplified
flag = [
['red', 'red', 'white', 'blue', 'blue'],
['red', 'red', 'white', 'blue', 'blue'],
['white', 'white', 'green', 'white', 'white'],
['black', 'black', 'yellow', 'black', 'black'],
['white', 'white', 'green', 'white', 'white'],
['blue', 'blue', 'white', 'red', 'red'],
['blue', 'blue', 'white', 'red', 'red'],
]
# Print each color block with the right color background
for row in flag:
for color in row:
print(colored(' ', 'grey', colors[color]), end='')
print()