What's wrong?

What’s wrong?

1 Like

The error message is technically wrong. The error should probably say the output doesn’t match the expected output. Check what it says the function should return, the console should print the exact same thing.

But ionatan is probably correct here, it’s asking specific instructions for the return values.

They say three values, not one. They don’t say how to bundle those up, but my first guess would be that they want a tuple of three strings. A list might be okay too. The name is also “extractor” so putting everything back into a single string doesn’t make sense. They’re being vague about whether the string should contain just the number or also "month = ", so try both I suppose.

Or maybe it’s just about the formatting error @toastedpitabread points out, that’d be the first thing to try.

2 Likes

The task conditions and solution code - in the screenshot. Is it visibly?
Can you answer more specifically, please, after you familiarize yourself with the picture? If you really understand the language

My reply’s wording is trying to point you at possible ways to find the problem. These forums are not about giving the answer away. @ionatan has been very specific where I wasn’t so it should be covered.

1 Like

one more solution

the result is the same

have you tried return r1, r2, r3 where the values are just the numerical values as strings?

r1 = '6', etc

but also you still have year =2006 with the space missing. There could be a variety of things throwing errors. This is not as much an issue of python as trying to get the code validated by the test.

For that it’s important to break down all the specific elements it could be valuing as important. It may seem trivial, but it’s an important skill in troubleshooting.

1 Like

Are there some administrators on this forum?

I thought the Code Academy (codecademy.com) teaches, and the learning process involves a dialogue with teachers, professionals. Reception of such answers (like the previous one, for example) can only teach - how not to use common sense and logic.

So there are administrators, professional coders and teachers at codecademy? Because I have the next question on training, and it’s about “datetime” again.

sorry for directness, I just came to learn from knowledgeable people and guesses are inappropriate here

What the site wants in this case? I followed the instructions of the training program…

It’s the extra space.

An aside: forums are communities, the point is to learn and share in a positive environment. Some will be experts and others will be knowledgeable enough to help.

Screen Shot 2020-06-27 at 11.26.16 AM

2 Likes

Haha. I actually spent time considering this one and I was going for removing excess whitespace and the print statement just in case the testing was weird. Perhaps someone can correct me but that one confuses me. Wouldn’t the extra whitespace just be ignored in this case? It’s a style issue perhaps but wouldn’t the import work perfectly well? Maybe it is just curious testing.

2 Likes

It is very much the codecademy validator insisting on a particular syntax as python doesn’t care in this scenario.

While I don’t like that for my own personal study, I think on average it’s good for the validator to insist on pythonic syntax to not let people think it’s ok to just circumvent convention “just” because the code runs. There will be other instances where code runs with improper syntax in one scenario, but if it’s paired with something complex it won’t run! So specificity is indeed important and not just pedantic for the sake of pedantry.

If one gets good at coding, they’ll eventually have to collaborate with others, and that means code legibility and documentation is of utmost importance.

Tl;dr: it’s a pedagogical choice the validator is enforcing.

@tgrtim i’m not saying you don’t know this, i’m just adding to the discussion!

The Zen of Python

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea – let’s do more of those!

3 Likes

I’m all for improving style and readability of code in lessons even if only by suggestion if not requirement (although it’s a dangerous game; perhaps there’s one and only one “best” way for code… if only… but style is a minefield). Spaces after keywords at least is something we can all agree upon. I was just surprised that it was a requirement since I don’t recall much of any testing along those lines in previous lessons and that error message isn’t really helping anyone. Not the end of the world, just surprising.

Haha, yes. I think that’s the first thing I remember using on Python. Even have a reference to it in my reply :wink:

I don’t often get angry in life, but the codecademy validator tests that principle every day :rofl: :rofl: :rofl: :rofl:

@tgrtim and yes, I think if anything codecademy can word the text on error messages better. Less towards the side of, it’s definitely this issue, and more to: perhaps it’s this issue

2 Likes