this is possible? You can add print statements
No you can't, at least not on the latest FF dev edition. Here's a broken solution to 'Scrabble Score', notice the three
word = word.lower()
tot = 0
for wordChar in word:
for scoreChar in score:
if scoreChar == wordChar:
tot += score[scoreChar]
Here's the console output when I run that:
The actual 'failure' message is kind of helpful:
Oops, try again. Your function fails on scrabble_score("pie"). It returns "3" when it should return "5".
But also not really, because I'm unable to print output to easily find out where that '3' comes from. It's not really a big issue in the example I posted, there's only one return statement, but if you've got multiple return statements nested in multiple loops it can get tedious fast. Yes, carefully reading the code line by line will show up your mistake, but it's often quicker trying to print out a few variables and see where stuff breaks, even with smaller blocks of code - we have debug tools and console outputs for a reason.
Let's make a change to that function and break it more by performing an invalid operation on a type, another common error in these exercises:
tot += str(score[scoreChar])
The 'failure' message output:
Oops, try again. Does your scrabble_score function take exactly one argument (a string)? Your code threw a "unsupported operand type(s) for +=: 'int' and 'str'" error.
No line number to show at which point the compiler choked. And console output is still
Once again, not a huge issue here as there's only one typecast in use, but in a couple of the first exercises typecasting was necessary (eg. iterating through ineteger digits) on a few occasions and the easiest way to quickly check at which point of the function I was messing up was to pull out lines of code where I'd normally
print some output.
Additionally, try and imagine what that error message (the only feedback they'll get) is going to look like to somebody who's sat down today and decided to do this course as their first ever introduction to programming:
Does your scrabble_score function take exactly one argument (a string)?
This section's actually irrelevant to them - the function does indeed take one string as an argument (although they have no way of checking that for themselves). So the first sentence is already seeding confusion. It's not even a standard compiler message, so I'm assuming it's been added as a hint.
Your code threw a "unsupported operand type(s) for +=: 'int' and 'str'" error.
I know what this means, you know what this means. Would you really expect someone who's been programming for maybe around 5 hours at this point to know what that means? That's a big ask... Sure, it's (mostly) a standard compiler error (except for the lack of line numbers, which I do get running the script locally, and the first sentence), but throwing compiler errors, and only compiler errors, at newbies without any introduction or explanation is, in my opinion, not the best approach.
I've occasionally run into problems with CA courses and Firefox however, and as that's now two people saying console output should work I'll see if it behaves any differently in Chromium.
Edit: No console output in Chromium either, although you do get better indent markers in the script window.