Seventh JSON of a seventh JSON
Description:
Context
According to Wikipedia : "The seventh son of a seventh son is a concept from folklore regarding special powers given to, or held by, such a son. The seventh son must come from an unbroken line with no female siblings born between, and be, in turn, born to such a seventh son."
Your task
You will be given a string of JSON, consisting of a family tree containing people's names, genders and children. Your task will be to find the seventh sons of seventh sons in the family tree, and return a set of their names. If there are none, return an empty set.
Tips
Have a good look at the sample test cases.
For a seventh son to be a seventh son, there must not be any daughters in the line leading to him. There may be daughters after him, though.
Use
print_tree
preloaded function to print the family tree in a compact human-readable formYou may want to use the
json
module for this one.
Similar Kata:
Stats:
Created | Nov 22, 2017 |
Published | Nov 22, 2017 |
Warriors Trained | 1188 |
Total Skips | 23 |
Total Code Submissions | 4347 |
Total Times Completed | 188 |
Python Completions | 117 |
JavaScript Completions | 81 |
CoffeeScript Completions | 6 |
Total Stars | 43 |
% of votes with a positive feedback rating | 88% of 56 |
Total "Very Satisfied" Votes | 45 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 6 kyu |