0

I got two codes to solve the pig latin challenge. Which one do you prefer? Why?

https://code.sololearn.com/c6pXIQ2Sek6Z/?ref=app https://code.sololearn.com/cYtLMqw2wkN5/?ref=app

29th Jan 2020, 12:08 AM
Urbo Fresco
Urbo Fresco - avatar
5 Réponses
+ 2
Your first code.....do it as a one-liner.
29th Jan 2020, 12:42 AM
rodwynnejones
rodwynnejones - avatar
+ 2
29th Jan 2020, 10:06 AM
Urbo Fresco
Urbo Fresco - avatar
+ 1
I'd choose the second code, namely "pig_latin_challenge2.py". Not only is it shorter and more readable, but it's also more efficient. You could improve it by using a list comprehension instead of the map() function. From my experience, list comprehensions are easier to understand.
29th Jan 2020, 4:20 AM
Diego
Diego - avatar
+ 1
And also I writed in one line as rodwynnejones said!
29th Jan 2020, 10:07 AM
Urbo Fresco
Urbo Fresco - avatar
0
I am not pretending to be praised. Just to share what I think is a progress in my python learning! I will apreciate if you share a perfect code to solve this chalenge! 😉
29th Jan 2020, 12:28 AM
Urbo Fresco
Urbo Fresco - avatar