Hi Everybody:
My name is Moises and I just joined this wonderful community.
I have a problem with task 5 on Tisbury Treasure Hunt excercise.
In the instructions section it shows the report format as:
“”"
(‘Brass Spyglass’, ‘Abandoned Lighthouse’, (‘4’, ‘B’), ‘Blue’)\n
But after running my code with no success the results_data shows:
"""('Scrimshawed Whale Tooth', 'Deserted Docks', ('2', 'A'), 'Blue')\n\
My confusion comes from :
- At the beggining of the report, a new line after """ should be included?
- Each line should include the '\n'
I have tried many alternatives with no success on passing the test.
Any help to point me to the correct answer is very appreciated. Thank you very much in advance. Best Regards
Here is my code:
def clean_up(combined_record_group):
report = '"""'
for item in combined_record_group:
list_from_tuple = list(item)
del list_from_tuple[1]
new_tuple = tuple(list_from_tuple)
report += str(new_tuple)
report += '\n'
report = report + '"""'
return report
CODE RUN
input_data = (
('Scrimshawed Whale Tooth', '2A', 'Deserted Docks', ('2', 'A'), 'Blue'),
('Brass Spyglass', '4B', 'Abandoned Lighthouse', ('4', 'B'), 'Blue'),
('Robot Parrot', '1C', 'Seaside Cottages', ('1', 'C'), 'Blue'),
('Glass Starfish', '6D', 'Tangled Seaweed Patch', ('6', 'D'), 'Orange'),
('Vintage Pirate Hat', '7E', 'Quiet Inlet (Island of Mystery)', ('7', 'E'), 'Orange'),
('Pirate Flag', '7F', 'Windswept Hilltop (Island of Mystery)', ('7', 'F'), 'Orange'),
('Crystal Crab', '6A', 'Old Schooner', ('6', 'A'), 'Purple'),
('Model Ship in Large Bottle', '8A', 'Harbor Managers Office', ('8', 'A'), 'Purple'),
('Angry Monkey Figurine', '5B', 'Stormy Breakwater', ('5', 'B'), 'Purple'),
('Carved Wooden Elephant', '8C', 'Foggy Seacave', ('8', 'C'), 'Purple'),
('Amethyst Octopus', '1F', 'Aqua Lagoon (Island of Mystery)', ('1', 'F'), 'Yellow'),
('Antique Glass Fishnet Float', '3D', 'Spiky Rocks', ('3', 'D'), 'Yellow'),
('Silver Seahorse', '4E', 'Hidden Spring (Island of Mystery)', ('4', 'E'), 'Yellow')
)
result_data = """('Scrimshawed Whale Tooth', 'Deserted Docks', ('2', 'A'), 'Blue')\n\
('Brass Spyglass', 'Abandoned Lighthouse', ('4', 'B'), 'Blue')\n\
('Robot Parrot', 'Seaside Cottages', ('1', 'C'), 'Blue')\n\
('Glass Starfish', 'Tangled Seaweed Patch', ('6', 'D'), 'Orange')\n\
('Vintage Pirate Hat', 'Quiet Inlet (Island of Mystery)', ('7', 'E'), 'Orange')\n\
('Pirate Flag', 'Windswept Hilltop (Island of Mystery)', ('7', 'F'), 'Orange')\n\
('Crystal Crab', 'Old Schooner', ('6', 'A'), 'Purple')\n\
('Model Ship in Large Bottle', 'Harbor Managers Office', ('8', 'A'), 'Purple')\n\
('Angry Monkey Figurine', 'Stormy Breakwater', ('5', 'B'), 'Purple')\n\
('Carved Wooden Elephant', 'Foggy Seacave', ('8', 'C'), 'Purple')\n\
('Amethyst Octopus', 'Aqua Lagoon (Island of Mystery)', ('1', 'F'), 'Yellow')\n\
('Antique Glass Fishnet Float', 'Spiky Rocks', ('3', 'D'), 'Yellow')\n\
('Silver Seahorse', 'Hidden Spring (Island of Mystery)', ('4', 'E'), 'Yellow')\n"""
self.assertEqual(clean_up(input_data), result_data)
TEST FAILURE
AssertionError: '"""(\'Scrimshawed Whale Tooth\', \'Deser[1012 chars]n"""' != "('Scrimshawed Whale Tooth', 'Deserted Do[876 chars]')\n"
Diff is 1016 characters long. Set self.maxDiff to None to see it.