Retired
Broken seven-segment display (retired)
Description:
A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display device for displaying decimal numerals.
![alt text][sev_seg]Above is a diagram of the seven-segment display I am using. However, some of its segments are broken. When I try to display the number a
, it becomes the number b
instead.
Task
Your task is to find the possible broken segments given the numbers a
and b
as strings.
There will be multiple SSDs forming a number, so you must return the broken segments of an SSD in a set, return an empty set if an SSD does not seem to be broken.
If a
can not become b
, throw an exception.
Examples
sev_seg('1000','1007') should equal [set(),set(),set(),{'D','E','F'}]
sev_seg('888','123') should equal [{'A','D','E','F','G'},{'C','F'},{'E','F'}]
sev_seg('-23',' 23') should equal [{'G'},set(),set()]
sev_seg('123','123') should equal [set(),set(),set()]
sev_seg('123','888') should throw Exception 'Invalid input'
Important notes
- If an SSD is not displaying anything, it will be
' '
. - If an SSD is displaying
'-'
, only theG
segment is working. a
andb
will always be strings of valid characters with the same length.- You may report to me if the description is too confusing.
Puzzles
Similar Kata:
Stats:
Created | Dec 6, 2018 |
Warriors Trained | 12 |
Total Skips | 0 |
Total Code Submissions | 37 |
Total Times Completed | 9 |
Python Completions | 9 |
Total Stars | 0 |
% of votes with a positive feedback rating | 31% of 8 |
Total "Very Satisfied" Votes | 1 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 5 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |