geekhack
geekhack Community => Other Geeky Stuff => Topic started by: Computer-Lab in Basement on Wed, 01 April 2015, 10:50:59
-
So I've been using Codeacademy to try and learn some Python stuff, and I get to this lesson when it says to:
Instructions
Create three dictionaries: lloyd, alice, and tyler.
Give each dictionary the keys "name", "homework", "quizzes", and "tests".
Have the "name" key be the name of the student (that is, lloyd's name should be "Lloyd") and the other keys should be an empty list. (We'll fill in these lists soon!)
And this is my code:
lloyd = {
'name': ['Lloyd'],
'homework': [],
'quizzes': [],
'tests': []
}
alice = {
'name': ['Alice'],
'homework': [],
'quizzes': [],
'tests': []
}
tyler = {
'name': ['Tyler'],
'homework': [],
'quizzes': [],
'tests': []
}
And it keeps giving me this error:
Oops, try again. The name key does not have the value "Lloyd" in your lloyd dictionary.
Am I crazy, or is Codeacademy crazy?
-
Do they want "Lloyd" including quotes?
-
single and double quotes are interchangeable in Python as far as I know. and I tried both and got the same error.
-
get rid of the square brackets surrounding the names, I don't think they want a list for the name key.
-
get rid of the square brackets surrounding the names, I don't think they want a list for the name key.
lloyd = {
'name': 'Lloyd',
'homework': [],
'quizzes': [],
'tests': []
}
alice = {
'name': 'Alice',
'homework': [],
'quizzes': [],
'tests': []
}
tyler = {
'name': 'Tyler',
'homework': [],
'quizzes': [],
'tests': []
}
-
welp... problem exists between keyboard and chair...
-
welp... problem exists between keyboard and chair...
It's a reasonable mistake to make. The lesson or whatever it's called was not too explicit in its' requirements.
-
I am getting PTSD from 'learning' this in school. What an absolute nightmare of a language.
-
I am getting PTSD from 'learning' this in school. What an absolute nightmare of a language.
what
-
welp... problem exists between keyboard and chair...
Looks like you got one of them I d10 T errors sir. Take two of these, and call me in the morning.
(http://www.drinkinginamerica.com/wp-content/uploads/2013/07/BostonLagerSamAdams.jpg)
But really, it happens. Took me a long time to learn how to look for errors in Python. Simple mistakes happen. As long as you're learning from them, it's completely acceptable.
-
I am getting PTSD from 'learning' this in school. What an absolute nightmare of a language.
What do you prefer? Or perhaps I should say, what makes it a 'nightmare'?
-
I am getting PTSD from 'learning' this in school. What an absolute nightmare of a language.
I assume this is an April Fools joke?
-
I've found Code Academy to be a great intro to coding for people who have no experience whatsoever, but soon you will realize that you want to go more in depth with a language than just printing out strings and numbers. Also as mentioned above, the instructions are sometimes not very clear and Code Academy tends to move rather slowly. If you have some experience in programming, http://help.exercism.io/getting-started-with-python.html (http://help.exercism.io/getting-started-with-python.html) might be more helpful. You basically use Git to commit and push your changes/exercises, which is then peer reviewed. The feedback is actually helpful, and they suggest ways to help you improve your code. Another good resource to check out if you're somewhat of a beginner but you're familiar with terminal and coding in general would be Learn Python The Hard Way by Zed Shaw.