Update
This isn't about whether you'd write the code for someone if asked on here for help in doing so. It's not whether you'd point someone in the right direction.
It's simply whether if you were given that brief would you jump in and start writing code for it or not.
Feel free to change your vote
etadpU
I know this isn't going to be statistically significant given the nature of the audience and that respondents are self selecting but I'm curious.
Assuming RPiOS and the command line "Prompt the user for a number. Continue prompting until the user enters '*'. Calculate the average and output it."
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Quick poll related to "Missing half the skill"
Last edited by thagrol on Wed Oct 14, 2020 11:22 pm, edited 2 times in total.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
Yeah it does but that wasn't intentional.
The question isn't about whether you'd do someone's homework but whether when given that brief you'd write the code.
I'll explain more once the poll has closed.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
Re: Quick poll related to "Missing half the skill"
Pretty sure that's what he meant - that brief sounds like homework, so it wouldn't get answered.
Myself, I'd simply suggest a way to do it, but not write the code.
Something like "you'll need <thing x> to prompt the user and then you'll want to loop that until <answer y> is given and something that counts the number of times the user answered before the <answer y> was given, and divide that by <function z that calculates an average."
Anybody who actually wants to learn how to do it, will search the keywords in that reply, and possibly come back with another question like "I tried this, but x failed, what did I do wrong"
55:55:44:44:4C
52:4C:52:42:41
Rose tinted glasses are difficult to see through.
52:4C:52:42:41
Rose tinted glasses are difficult to see through.
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
Guess I should have phrased it differently. It's not about whether you'd write it for someone else or if you'd point them in the right direction.
It's about whether, given that brieff, you'd jump straight in and write the code or not.
It's about whether, given that brieff, you'd jump straight in and write the code or not.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
- DougieLawson
- Posts: 40825
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: Quick poll related to "Missing half the skill"
The code for that is already on Stackoverflow. Doesn't take much to feed your question into the Googles.
https://stackoverflow.com/questions/539 ... te-average
https://stackoverflow.com/questions/539 ... te-average
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
I know. That isn't my point or what I'm trying to ascertain.DougieLawson wrote: ↑Wed Oct 14, 2020 11:22 pmDoesn't take much to feed your question into the Googles.
I will explain but not til after the poll closes as doing so would probably bias results.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
OK. I promised I'd explain so...
Firstly | guess the result aren't in anyway statistically significant. They're also not what I expected but that's probably due to the self selected nature of respondents.
I was trying to get an idea of the number of people who'd dive in and write code for what is a vague and incomplete spec. Looks like 25%.
If you're wondering, I didn't cast a vote but mine would have been "No". Writing code from that spec requires too many assumptions, for example:
The code you linked falls right into the above trap and is trivially breakable. Just enter 0 as the first number.
Firstly | guess the result aren't in anyway statistically significant. They're also not what I expected but that's probably due to the self selected nature of respondents.
I was trying to get an idea of the number of people who'd dive in and write code for what is a vague and incomplete spec. Looks like 25%.
If you're wondering, I didn't cast a vote but mine would have been "No". Writing code from that spec requires too many assumptions, for example:
- What, exactly, is meant by "number"? Integers, real, complex, imaginary?
- Is the desired "average" the mean, the mode, or the median?
- Is there a maximum permitted value for a number? That may not seem important but it can be for strongly typed langauges (float vs double)
- How many deciaml places are needed for the result?
- 1, 1.0, one, one quater, 1/4, 1000 and 1,000 are all valid ways to express a number. Which ones should the code except?
The code you linked falls right into the above trap and is trivially breakable. Just enter 0 as the first number.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
- DougieLawson
- Posts: 40825
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: Quick poll related to "Missing half the skill"
That's fair, but you've just changed the question from a trivial one into one that needs some knowledge of maths/stats. The "Eternal September" CS101 questions we see on here typically match your original spec.
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Re: Quick poll related to "Missing half the skill"
writing code to that original spec means you are giving an outline code.
Simple, no checks and just whatever is default to get a result.
if they ask for more, error checking, bounds, formatting, switching the average from the default mean (normal usage) to a different one if needed.
but that's different, that wasn't asked for.
the basic outline will still work, tweaking the process is just tidying up.
So to me, two completely different questions, but it does mean I understand the original question now.
So yes, I could dive in and write the outline.
add checks if asked or they can do it now they have the basis
--
Also calculate the average then makes me assume it means from all entered values, it not actually stated of course
which is part of the point I guess.
Simple, no checks and just whatever is default to get a result.
if they ask for more, error checking, bounds, formatting, switching the average from the default mean (normal usage) to a different one if needed.
but that's different, that wasn't asked for.
the basic outline will still work, tweaking the process is just tidying up.
So to me, two completely different questions, but it does mean I understand the original question now.
So yes, I could dive in and write the outline.
add checks if asked or they can do it now they have the basis
--
Also calculate the average then makes me assume it means from all entered values, it not actually stated of course

Last edited by bensimmo on Mon Oct 19, 2020 3:28 pm, edited 1 time in total.
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
Yeah they do. But I don't see that I've change teh question in te way you outlined.DougieLawson wrote: ↑Mon Oct 19, 2020 3:10 pmThat's fair, but you've just changed the question from a trivial one into one that needs some knowledge of maths/stats. The "Eternal September" CS101 questions we see on here typically match your original spec.
Perhaps it was a poor choice of example, but then again a more complex one would likely have cause just as much confusion but in a different way.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
Re: Quick poll related to "Missing half the skill"
A more involved and complicated one changes the type of question too
it takes longer it may not just be a get me started outline help/task/question, it's more than a few lines of code.
Still an outline code could be written, specifics added later if they or you want.
And this pole in itself shows how hard it is to describe what's wanted.
Each to their own in what they need to help someone.
Some need no detail, some need specific detail, some need every last bit of possibility ever imagined, some use Excel as a go between for a countries multimillion pound people tracking program.
it takes longer it may not just be a get me started outline help/task/question, it's more than a few lines of code.
Still an outline code could be written, specifics added later if they or you want.
And this pole in itself shows how hard it is to describe what's wanted.
Each to their own in what they need to help someone.
Some need no detail, some need specific detail, some need every last bit of possibility ever imagined, some use Excel as a go between for a countries multimillion pound people tracking program.
- DougieLawson
- Posts: 40825
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: Quick poll related to "Missing half the skill"
It's not a poor choice, because the "100% correct" answer needs to cover all of those cases you've listed today. The problem with covering all of those extra rules leads to over engineering and function creep, I'd guess the tutor posing a question like that would qualifiy it with "Answer this in 20 lines of python", "think about things that are going to break your code" - that negates the dumb answer I sniffed out with the naïve Google search.
There's also some bias here because we know we can trust you and we know you can be deviously clever.
Usually I won't do the programming homework things unless I'm going to learn something from it or already have the answer to cut'n'paste, so my negative response to your poll still stands.
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
Precisely. And that's my point. Isn't it better to go back and ask for clarification than to spend time writing and debugging code based on assumptions made from a poor specification?
Maybe, in a trivial case though even then assumptions can cause problems. I useed a trivial examplethe basic outline will still work, tweaking the process is just tidying up.
Not everything is "tweaking" changing from mean to median or mode requies different methods of calculation.So to me, two completely different questions, but it does mean I understand the original question now.
So yes, I could dive in and write the outline.
add checks if asked or they can do it now they have the basis
I guess it's a programmer vs tester thing.
If you write something based on assumptions you'll end up going back to clarfiy those points anyway. You also end up with more stress between programmer and tester/end user.
It's also a good way to miss deadlines and lose contracts. Seen that happen too often.
For CS101 an answer based on assumptions and that only runs under ideal conditions may well be fine. Out in the wild more likely than not it isn't. Good habits should start early.
Doesn't matter if you're writing code, desiging tests, or building a house. it's easier and cheaper to get clarification first rather than fix things later. And not everything can be fixed later - didn't NASA* lose a Mars probe because one software team had assumed metric units and another had assumed imperial?
*: or was it ESA, I forget.
Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
DougieLawson wrote: ↑Mon Oct 19, 2020 3:38 pmThere's also some bias here because we know we can trust you and we know you can be deviously clever.

Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
- davidcoton
- Posts: 5868
- Joined: Mon Sep 01, 2014 2:37 pm
- Location: Cambridge, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
I think there are two different contexts. The majority answer is based on writing code at a professional level, where the first step is to disambiguate and complete the spec. What is presented represents a marketing-style requirement, it needs some work (including questions to the originator) along the lines you indicated to get something useable in a SMART process.
However, as an informal description of what someone wants, it is possible to code directly from it -- as long as all parties involved realise its limitations. (If they don't, sooner or later they'll learn the painful way
) In many cases the meaning of average will be known, or the arithmetic mean can be assumed with a high degree of certainty. Similarly, range limits may not come into question -- in most contexts values are not likely to exceed the normal range of modern systems. That might be different, for example, if the target platform is an ancient 6502 programmed in Assembler, or even a high-level language still using 16-bit integers as standard. Integer or real variables is more significant, but may be "obvious" (ie, a dangerous guess) in real-world cases, based for example on the problem domain (financial, scientific, game scoring, etc), and a good programmer will spot that even with integer input, the result may not be an integer. OTOH the implementation may be Python which will alleviate many of the spec's ambiguities.
Finally, of course, the test cases need to be agreed in advance with the originator. Then the coder can pass the buck when new test data is introduced and fails.
Hopefully the example really is an initial CS101 question which is used to teach all the subtleties mentioned here.
However, as an informal description of what someone wants, it is possible to code directly from it -- as long as all parties involved realise its limitations. (If they don't, sooner or later they'll learn the painful way

Finally, of course, the test cases need to be agreed in advance with the originator. Then the coder can pass the buck when new test data is introduced and fails.
Hopefully the example really is an initial CS101 question which is used to teach all the subtleties mentioned here.
Location: 345th cell on the right of the 210th row of L2 cache
- thagrol
- Posts: 4236
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Quick poll related to "Missing half the skill"
Probably only in this case, and even then not if python2. It's floor division behaviour with ints will get in the way. "1, 2, 3,4" and "1.0, 2.0, 3.0, 4.0" will return different results due to python's lose auto typing.davidcoton wrote: ↑Mon Oct 19, 2020 3:51 pmOTOH the implementation may be Python which will alleviate many of the spec's ambiguities.
Sometimes, yes. More often, at least in my experience, the testers write tests from the same spec as the coders wirte the code.Finally, of course, the test cases need to be agreed in advance with the originator.
Buckpassing is never good. Doesn't matter who does it. Fix the problem not the blame.Then the coder can pass the buck when new test data is introduced and fails.
Not that I'm aware of but it is the type of thing I consider likely to be used.Hopefully the example really is an initial CS101 question which is used to teach all the subtleties mentioned here.
In someways coding is like playing a musical instrument: you don't stop practising when you can play a piece of music. You stop when you can play it without making a mistake. And not always then.
Editied for tpyos. You'd think after 40 years mucking around with computers I'd be able to touch type

Arguing with strangers on the internet since 1993.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.
Re: Quick poll related to "Missing half the skill"
you see, I wasn't replying as a pro or contract or time limited person.
that would alter my judgment.
I was replying as a teacher helping a student just get going or a mate.needing something to work. They could then take that and work on it or work together to do what is needed.
I don't code for money.
in Python3 it's quite easy to switch mean,mode,median.
Language wasn't specified
and o wouldn't touch an EOL language like Python2.
Just my preference.
Have fun and why don't some people slap some code down, as simple or as error checking on assumptions as they want.
Neither is wrong.
Each to their own.
touch type, on my mobile they have stuck the . right where my thumb thinks the space bar is
I'm constantly hitting it and can't move it.
that would alter my judgment.
I was replying as a teacher helping a student just get going or a mate.needing something to work. They could then take that and work on it or work together to do what is needed.
I don't code for money.
in Python3 it's quite easy to switch mean,mode,median.
Language wasn't specified

Just my preference.
Have fun and why don't some people slap some code down, as simple or as error checking on assumptions as they want.
Neither is wrong.
Each to their own.
touch type, on my mobile they have stuck the . right where my thumb thinks the space bar is
