Hi, is it normal to struggle a lot on the Practice Makes Perfect course? I struggled on about 90% of it and now I feel really dumb, how did you all find it your first time?
Its perfectly normal to struggle there, given this introduces an important concept of programming, which is programming design. You need to design the program, rather then being told to do so by instructions, this will push your programming to next level
Ideally, write pseudo code (which just abstract english on how your solution should look), look at which function you learned, and which you could use for your solution.
Its highly recommend to take your time for this section.
Thank you for the help, glad to hear its normal.
I would also add that this is a perfect time to go back to the beginning and review everything you have learned up to this point. There is no point racing forward if you are struggling, the struggle will only get harder. A good many of the concepts covered so far are fundamental and we should know them in our sleep. Build on a solid foundation, not a weak one. It will be less frustrating and confusing going forward.
Hi, thank you for the help and advice, I have been going to a lot of it, I write notes on the ones that are important or hard to remember.
You’re welcome. It’s good to see you are keeping notes. Be sure to revise them as you get more grounded and better informed.
When reviewing consider that the two best approaches to learning (especially at the beginning) are repetition and variation. Repetition to build muscle memory and get the concepts ingrained in one’s mind, and variation to see all the myriad ways that we can accomplish the same task. Never stop just because you have a solution. Try to break it, improve upon it, and perfect it. Then try another approach and repeat.
Thank you. You have made me realise to think for the long run. I will restart “Practice Makes Perfect” tomorrow and keep trying the exercises till I understand them. I mostly struggle on the wording and knowing where to start.
Many of our algorithms involve loops. If we assume there is going to be a loop in the solution, then start with that. What will the loop look like?
alpha = "abcdefghijklmnopqrstuvwxyz"
How would we convert all the vowels to uppercase? It is evident we will be iterating over the alpha string, and examining each letter. We know that we cannot mutate the string (without a built-in method) so it follows we will build a new one.
beta = ""
We can use a look-up loop to examine each letter:
for letter in alpha: beta += letter if letter not in "aeiou" else letter.upper() print (beta) # AbcdEfghIjklmnOpqrstUvwxyz
The Python ternary is (I believe) introduced prior to the Practice Makes Perfect unit, though it may not have been explored very much. This is one example of putting it to use. Usage is a big part of learning. The more ways we know to use something, the more ways we can approach a problem. That is where the title of this unit really stands out.
Hi, the example helped me understand what you meant a lot more, Practice Makes Perfect course is the hardest but the best one I would say. If we was aloud to use a built-in would we do:
alpha = "abcdefghijklmnopqrstuvwxyz" alpha == alpha.uppercase()
Would be False. That is a comparison, not an assignment. Also, there is no
uppercase method. In Python it is,
alpha = alpha.upper()
will be all capitals.
Thank you for the help. I had
alpha = alpha.uppercase() at first but changed it too
==. Silly mistake. But that would still not be right.
If you have an interactive console open while you are working, you can test expressions there.
>>> alpha = "abcdefghijklmnopqrstuvwxyz" >>> alpha == alpha.uppercase() Traceback (most recent call last): File "<pyshell#252>", line 1, in <module> alpha == alpha.uppercase() AttributeError: 'str' object has no attribute 'uppercase' >>>
We won’t break the computer if we enter invalid code, and the error messages are invaluable since we don’t have to search for the error. It’s right there in our command.
>>> alpha.upper() 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' >>> alpha 'abcdefghijklmnopqrstuvwxyz' >>> ''.join([s.upper() if s in 'aeiou' else s for s in alpha]) 'AbcdEfghIjklmnOpqrstUvwxyz' >>>
The last line is a teaser that gets introduced in the Advanced Topics unit. Ignore it for now.
Bottom line, practice expressions in the command line to learn how they work and how to predict what their returned values will be. Expressions always yield a value.
Hi, I am still struggling on practice makes perfect, I understand what they are wanting me too do but Im just struggling so much to be creative, I feel useless. Sorry for being a pain with the questions but when you said I should review everything do you mean, start back at the first course and complete them all again?
If that is what it takes then yes, do the material as many times as you need to get it down. Ground yourself in the basics and do lots of practice. Spend the time on each lesson to learn the new concepts. Read documentation, look for examples, experiment and practice, practice, practice.
Thank you for the help, I’ll start the course again, and Im going to complete python projects from websites to improve me thinking for my self more instead of relining of instructions
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.