Unit 8: Practice makes Perfect



<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
What is the point of the lesson? It doesn’t teach anything. Instead, it is getting you to do things that hasn’t even been taught. I don’t see how it is possible to complete. I’ve done every lesson so far, without help. But ‘Practice makes perfect’ makes absolutely no sense and I have no idea what I am suppose to be doing, how to do it, or what I’m trying to do. I can only complete the lesson by copy/pasting other peoples codes, and I have no idea what any of it even means. How are we suppose to complete the lesson?
<What do you expect to happen instead?>
I don’t understand the entire lesson ‘Practice makes perfect.’ It doesn’t even teach anything. It is impossible to do because we haven;t even been taught how to do anything that it’s telling us to do.

```python def anti_vowel(text): words = [str(text)] for 'a' in words: words.remove('a') for 'e' in words: words.remove('e') for 'i' in words: words.remove('i') for 'o' in words: words.remove('o') for 'u' in words: words.remove('u') return words #and i get the error Oops, try again. Your code looks a bit off--it threw a "list.remove(x): x not in list" error. Check the Hint if you need help!. #What am I doing wrong? How am I suppose to fix it if I don't know what I'm doing wrong?
<do not remove the three backticks above>


@deathswagga: Hello.
I know how bad it is to have no idea how to do your code but in the previous lessons, information about conditionals and loops were shown to you so if you stop think a little bit more about it, you’ll see you can do it!

Regarding the first link: it’s just an introduction. Okay, maybe they could’ve done something more like giving us an example of what we were about to do but maybe it’s not needed.
You need to press the green button to continue.
But hey, if you think this should be changed, get in touch with Codecademy staff! Maybe you have a better idea for the course and such will make it even better for all students!
I’m serious about it!

Okay, so back to the problem with the vowels!
Imagine like this: you’re not actually creating a code but doing this in real life. Let’s say I give you a word made of cards and each card has a letter, from a to z and also A to Z.

If I tell you to remove all the vowels, what will you do?

You’ll get card by card and analyze whether is a vowel or not.
If it’s not a vowel, you’ll get that card and put somewhere else.
You’ll continue to do this until you’ve reached the last card.

After that, what will be the word, considering the image, that you’ll have?
It will be “DNC”.

Did you notice that this is something we naturally do? If so, did you noticed we used conditionals, loops and comparisons operators to finish our mission?

Now back to coding: of course there are more fancy ways to do this but you’re not obligated to do it! If someone found an easier way, good for them!
As long as you try, it’s fair enough!

Try to first think about how you would solve this if it was a real life problem to later come up with a code, you’ll see things will be easier comparing to go straight to the code!

Now to your actual code: you’re trying to convert the argument, the “thing” between the parentheses in the function definition, to a string.
It’s fair, in case our user’s input is a number, for example, but let’s consider everything goes well!

Okay, so you have converted your argument into a string and you’re assigning that to your list words.
Well, that isn’t really correct, I mean, it would give an incorrect output.

At the first time you call the function, the variable words will be created.
Since you’re assigning a value between brackets you’re telling your code that your variable words isn’t just a variable, is a list and since you’re doing that you’re also telling your program that your list has only one element.

Try doing this:

text = "Text" words = [text] print len(words) #1
Q: Why is it one?
A: Because there’s just one element on your list.

Q: So I just need to do words = [str(text)] each time?
A: Well, when it comes to lists we have a certain amount of “slots”, positions. Doing the segment of code above, will overwrite the last data that was in that position.

#Begin words = [ ] #No elements words = ["Test"] #Now you have one element and it's on position one words = ["Test 2"] #Now you have overwritten the content in that position,which was "Test", to "Test 2"

Q: How to determinate the size of it?
A: Either go inserting, manually, new elements or create a loop instruction to iterate from 0 to N - 1 (since computers count positions from 0 to N -1 where N is the actual size of your list)*

*Check the range() function!

Q: Okay, so my question about the vowels?
A: Oh, yeah… true, my bad! Okay, so about your code.
I think you know why we use loop instructions to iterate over it but doing for ‘a’ in words isn’t correct.
The name right after the name for should be a variable, something that will be used to iterate over something, and the name after the name in should be the thing we will iterate with (most commonly are lists but we have dictionaries and tuples). In your case you have a constant and you’ll try to iterate over something, this won’t work.

Q: So, how does one go from position to position in a given list?
A: Like this:

for iterableVariable in element_to_be_iterated: print iterableVariable

The iterableVariable will iterate over element_to_be_iterated, it stores a value into it, getting the value at each position so printing iterableVariable will bring back a value that’s on your list, considering your list is not empty.

Q: How about strings?
A: Same idea as lists but in this case you’re dealing with characters.

Q: Okay, okay. How do I do this code?
A: Don’t mind the list manipulations methods in Python, try doing this in the easier way to learn go to more complex things, unless you’re familiar with them.

So, to finish it up do it like we spoke about it with the word “DANCE”.
Go from element to element, check a condition, if it’s true do something, if not do something as well.

After all of this, you’ll get a word without the vowels.

I hope after all of this explanation, things got clearer to you!
If I took to long to get to the answer, I apologize!