Found something cool - anti_vowel


#1

Hello

To start I would like to give credit to - https://discuss.codecademy.com/users/stetim94.
This moderator mentioned to me the use of documentation in a post regarding loops.

Something I struggled with was removing vowels from a string. Instead of Googling for an answer, I decided to use the documentation (docs.python.org/2/library) and found something very cool, called string.translate. I started experimenting & here is the result:

If you want to read how it works, here's the link:
(Please note this is for Python version 2.7.12.)
https://docs.python.org/2/library/string.html#string.translate

If anyone else finds cool built-in functions,etc - in Python, please share.


#2

Ow that's so cool!

Thanks for sharing this information :slight_smile:


#3

the only problem then that people do this:

just posting the answer to a topic, without explaining anything, the person who then created the topic learns very little, and won't understand what was wrong with there code in the first place

I agree it is a cool solution, don't get me wrong, it is nice to experiment with built in functions, unfortunately some people then re-post it on topics where it is not relevant


#4

Hello

Just wanted to share that the use of documentation instead of Googling for the answer could sometimes result in finding cool stuff. That's why I included the link to the documentation.


#5

I understand, but then people (being people) want to impress people and will start posting your solution to other topics.

If you see this, please flag them as inappropriate, then we can remove them.


#6

I did not realise that was happening.
Thank you for explaining.
I understand and will be more conscious now.


#7

It took me hours, but I found, and managed to do it with the replace method. And I couldn't make it in less than six lines.

Since it took me so much time, I am curious as to how much time it took other people with poking in the reference, experimenting and failed experiments included.


#8

Hello

It took me hours as well.

I used the replace method in the next lesson & got it down to 3 lines. The truth is one needs to understand how these built-in functions work & how to read technical documentations. I rather want to put the long reading & experimenting hours in now (Code Academy provides the perfect platform), then have the added pressure once I have a job.


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.