learnpack / learnpack

Main Documentation and Project
learnpack.vercel.app
8 stars 7 forks source link

Excercise Bug: 12.6-Transformers #1584

Open CMcLeodC opened 6 months ago

CMcLeodC commented 6 months ago

Describe the bug:

1. Exercise Name: 12.6-Transformers

2. Repository URL: https://github.com/4GeeksAcademy/python-lists-loops-programming-exercises

my code returns the correct output, but learnpack says it is incorrect

incoming_ajax_data = [ { "name": 'Mario', "last_name": 'Montes' }, { "name": 'Joe', "last_name": 'Biden' }, { "name": 'Bill', "last_name": 'Clon' }, { "name": 'Hilary', "last_name": 'Mccafee' }, { "name": 'Bobby', "last_name": 'Mc birth' } ]

Your code here

def data_transformer(list): return list["name"] + " " + list["last_name"]

full_name = list(map(data_transformer, incoming_ajax_data)) print(full_name)

AnggieAlava commented 5 months ago

@CMcLeodC Dear student, analyzing your solution and the instructions together with the 4Geeks test, I came to the same conslusion as you, although it is true that your solution returns the same output as indicated in the instructions, it is still not of the correct type. First it is recommended not to use reserved words like "list" as variable names or function arguments, Second as you can analyze the incoming_ajax_data is a List[Dict[str,str]], therefore the function data_transformer is asked to return a List[str], but your solution returns a string, even though they look the same, in reality they are not. I hope that the explanation together with the images with the details of the I/O data type are useful to understand the solution.

Image

Image