1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hi Guest, welcome to the TES Community!

    Connect with like-minded education professionals and have your say on the issues that matter to you.

    Don't forget to look at the how to guide.

    Dismiss Notice

Blog Post on File Reading in Python

Discussion in 'Computing and ICT' started by Compucademy, Jun 13, 2019.

  1. Compucademy

    Compucademy New commenter

  2. Dorsetdreams

    Dorsetdreams Occasional commenter

    Hum... "it is a good idea if we can keep our python code similar in structure to how we would write it in pseudocode" seems like putting the cart before the horse.

    Then "Python programmers often pride themselves on how well they can 'speak fluent Python', using all the best practices and powerful shortcuts of the language. List comprehensions... " . Interesting and I'm sure true, but this just illustrates to me that Python may not be the best language to start students on.
  3. MigsAna

    MigsAna New commenter

    The site seems to be blocked at my school but ...
    My students write pseudocode along the lines of
    FUNCTION readlinesToList(fileName)
    #opens a text file and returns a list - one line to one element
    localList = [ ]
    #possible exception handler if file does not exist
    myFile = openFileToRead(filename)
    #put lines in a list
    localList = readLines(myFile)
    RETURN localList

    The students then implement this in Python.
    I find students learn very well with Python and I have taught many different languages over many years.
  4. Compucademy

    Compucademy New commenter

    In my opinion pseudocode is often an necessary complication. Its syntax is very similar to BASIC which some of us grew up with. Python is very clean in comparison and reads very much like English, which is the whole point of pseudocode in the first place, along with portability between languages. But for that goal, a more C++/JS style syntax is actually much more common outside of GCSE and A Level syllabuses. The only virtue I can see in exam board style pseudocode is that it helps you write TI-BASIC on a TI-84 graphing calculator.

    Of course some will disagree.
  5. Compucademy

    Compucademy New commenter

    I meant "unnecessary," but of course it's needed for the exam!
  6. moscowbore

    moscowbore Lead commenter

    In my opinion python is a terrible language to use to teach programming. The lack of data types and proper arrays alone make it unsuitable. I would also suggest that students can learn bad habits with extended use of python, or as some people call them," best practices and powerful shortcuts of the language".
    Python is too idiosyncratic, whereas VB, Java, C++ all have basic elements which make it easier for students to transition to other programming languages.

    I like students to write pseudo code for all but the simplest problems. It helps to focus on the solution not the code. The code flows easily from well thought out pseudo code which should be language independent. In my opinion obviously...
  7. Compucademy

    Compucademy New commenter

    I'm often surprised at how strongly some people feel about this. Have you heard of a PMI from Edward de Bono? It's basically a structured pros/cons exercise that can provide new perspectives.

    "Python a good language the use for teaching programming"

    We go in order - plus first:

    There are tons of excellent resources available for learning it
    It's syntax is relatively simple and it often reads like English
    There are modules that enable quick access to powerful functionality such as graph plotting, graphics and GUI building
    It's used extensively by Google/YouTube
    You don't need to know OOP to write "Hello world!"

    Then the minuses:

    It's syntax is quite different to other languages
    It's slower than some languages in some situations
    It uses lists instead of arrays which could create confusion

    Then "interesting" (neither good nor bad but perhaps worth exploring):

    Is there any research to show pedagogical impact of choosing Python over other languages?
    How different is Python to Java, compared to how different C# is to Java, for example?
    Is similarity to other languages desirable or detrimental?
    Is there a better language to use than any under consideration (maybe JS)?
    How important is the the decision of which language to use?
    Do the level of student motivation, ability and long-term goals affect the decision?


    I'm curious to hear if you would add/change anything if you did this exercise yourself (maybe some more "minuses" that I am not aware of), and/or what a PMI would look like for, say, Java.
    Last edited: Jun 14, 2019
  8. moscowbore

    moscowbore Lead commenter

    I would add that python is a popular language because there ARE lots of resources available. Teachers who know nothing about programming being managed by managers who know nothing about programming will automatically choose the most popular option.

    I have met many teachers of CS over the years. Only those who have little knowledge or understanding of programming choose to teach python, in my experience.
  9. madcat

    madcat Occasional commenter

    So long as you realise the vast majority of your (GCSE level) students will never, ever program a computer again (probably close to 99% in many schools).

    Then it does not matter one damn what language you teach, so long as
    a) they can answer the questions in the exam ;
    b) they gain some experience with basic problem solving
    c) they walk away with some, albeit limited, appreciation.of he link between computers and programming.

    While I do appreciate the power and usefulness of Python, I still do not think, given its complexity and unusual syntax (as the file handling example above shows), that it is an appropriate language for beginners or those of limited ability

    Given the choice I'd still use SmallBASIC or similar for most (possibly with a sojourn or two into Java , Python etc for the higher ability students)
  10. Compucademy

    Compucademy New commenter

    SmallBasic is great but I don't see any educational advantage over Python myself, especially if we add Turtle into the mix. As for the strong views against Python, I would be interested to read a PMI as described above for other choices.of language.
  11. Dorsetdreams

    Dorsetdreams Occasional commenter

    The significant advantages of Python that you have not mentioned is that it is FOSS and cross-platform.

    The one thing I hate about my SmallBasic > VB.net > C# journey is that it is so Microsoft-centric.

    So, I mix in a bit of Python now and then. We all benefit from variety, especially learners. I make a point of not responding when they say they hate Python.

Share This Page