Retired

Convert Pixels of an Image into Brightness Value (retired)

Description:

Hello!

In this kata you will be given a list containing a tuple for the rgb values of each pixel in an image. At the end of each row of pixels will be a 'new'

Example:

[(0, 0, 0), (255, 255, 255), (255, 255, 255), (255, 255, 255), (0, 0, 0), 'new',
(255, 255, 255), (0, 0, 0), (255, 255, 255), (0, 0, 0), (255, 255, 255), 'new',
(255, 255, 255), (255, 255, 255), (0, 0, 0), (255, 255, 255), (255, 255, 255), 'new',
(255, 255, 255), (0, 0, 0), (255, 255, 255), (0, 0, 0), (255, 255, 255), 'new',
(0, 0, 0), (255, 255, 255), (255, 255, 255), (255, 255, 255), (0, 0, 0), 'new']

Your job is to take each tuple of rgb values and turn them into a symbol depending on their brightness.

Example:

(255, 255, 255) --> '@'
(0, 0, 0) --> '.'

The brightness will be ranked from 1 to 12 values and the 'new' will be marked as a '\n'

1 Brightness = '.'
2 Brightness = ','
3 Brightness = '-'
4 Brightness = '~'
5 Brightness = ':'
6 Brightness = ';'
7 Brightness = '='
8 Brightness = '!'
9 Brightness = '*'
10 Brightness = '#'
11 Brightness = '$'
12 Brightness = '@'
'new' = '\n'

The final result of the first example is this:

['.', '@', '@', '@', '.', '\n',
'@', '.', '@', '.', '@', '\n',
'@', '@', '.', '@', '@', '\n',
'@', '.', '@', '.', '@', '\n',
'.', '@', '@', '@', '.', '\n']

Have fun!

Algorithms
Logic

Stats:

CreatedOct 14, 2021
Warriors Trained11
Total Skips0
Total Code Submissions54
Total Times Completed5
Python Completions5
Total Stars0
% of votes with a positive feedback rating0% of 4
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes4
Total Rank Assessments3
Average Assessed Rank
5 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Micahthebomb Avatar
Ad