geekhack

geekhack Community => Other Geeky Stuff => Topic started by: Computer-Lab in Basement on Wed, 01 April 2015, 10:50:59

Title: Learning Python
Post 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:

Quote
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:

Code: [Select]
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:

Quote
Oops, try again. The name key does not have the value "Lloyd" in your lloyd dictionary.

Am I crazy, or is Codeacademy crazy?
Title: Re: Learning Python
Post by: SpAmRaY on Wed, 01 April 2015, 10:55:39
Do they want "Lloyd" including quotes?
Title: Re: Learning Python
Post by: Computer-Lab in Basement on Wed, 01 April 2015, 10:58:47
single and double quotes are interchangeable in Python as far as I know. and I tried both and got the same error.
Title: Re: Learning Python
Post by: trizkut on Wed, 01 April 2015, 11:06:57
get rid of the square brackets surrounding the names, I don't think they want a list for the name key.
Title: Re: Learning Python
Post by: Dihedral on Wed, 01 April 2015, 11:08:14
get rid of the square brackets surrounding the names, I don't think they want a list for the name key.

Code: [Select]
lloyd = {
    'name': 'Lloyd',
    'homework': [],
    'quizzes': [],
    'tests': []
}

alice = {
    'name': 'Alice',
    'homework': [],
    'quizzes': [],
    'tests': []
}

tyler = {
    'name': 'Tyler',
    'homework': [],
    'quizzes': [],
    'tests': []
}
Title: Re: Learning Python
Post by: Computer-Lab in Basement on Wed, 01 April 2015, 11:13:12
welp... problem exists between keyboard and chair...
Title: Re: Learning Python
Post by: Dihedral on Wed, 01 April 2015, 11:14:32
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.
Title: Re: Learning Python
Post by: noisyturtle on Wed, 01 April 2015, 17:22:43
I am getting PTSD from 'learning' this in school. What an absolute nightmare of a language.
Title: Re: Learning Python
Post by: clacktalk on Wed, 01 April 2015, 17:24:14
I am getting PTSD from 'learning' this in school. What an absolute nightmare of a language.

what
Title: Re: Learning Python
Post by: exitfire401 on Wed, 01 April 2015, 17:28:43
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.
Title: Re: Learning Python
Post by: pr0ximity on Wed, 01 April 2015, 21:27:18
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'?
Title: Re: Learning Python
Post by: jacobolus on Wed, 01 April 2015, 21:32:45
I am getting PTSD from 'learning' this in school. What an absolute nightmare of a language.
I assume this is an April Fools joke?
Title: Re: Learning Python
Post by: retrochick on Mon, 20 April 2015, 11:13:43
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.