3 ms·
That's an easy one... In Ruby, I can do string.reverse(). Python makes me type string[::-1] to reverse a string. In a nutshell, that is why Ruby is better than
by 16s 16y ago
That's an easy one... In Ruby, I can do string.reverse(). Python makes me type string[::-1] to reverse a string. In a nutshell, that is why Ruby is better than Python.
I must admit that I use Python more than Ruby. I like both, but know Python better. I feel Ruby is more consistent though. Either is a good language!
- koenigdavidmj 16y agoYou can actually say `reversed(iterable)`, which returns another iterable yielding everything backwards. Now, this is not returning a string, which leads to some warts: * list(reversed(a_list)) * "".join(reversed(a_str)) and the like.