Teaching Python vs HTML

So, I was talking to a colleague the other day and he was asking me about my experience teaching Python at secondary schools, mainly – “is Python forgiving”? My simple answer was – No! Python is not forgiving at all in comparison to HTML.

I now primarily teach the web trifecta – HTML, CSS and JavaScript and the question came about because of the forgiving nature of HTML. Students can submit some shockingly ill-formed code that will still display in a browser.

For instance –

<p>hello world</p>

will display “hello world” in a browser. Yes, it works, but it is far from well-formed or best practice, such as –

<!DOCTYPE html>

<html>

<head>

<title>better code</title>

</head>

<body>

<h1>Hello, World!</h1>

</body>

</html>

Python, on the other hand, is far more pedantic about its syntax rules. Often a simple misplaced / or : or “ instead of ‘ will render the code useless. I would spend hours of teaching code locked in debugging to find where a student had forgotten that colon! Don’t get me wrong, I love debugging – no, I really love debugging, and I am good at it because I enjoy it. However, debugging code because a student cannot copy from a book without dropping a colon is not so much fun.

If I am to compare the two languages in a teaching environment, teaching Python is probably easier. Why, you ask? Well, because-

·        it has to be right to work!

·        It has to be indented

·        It has to be well-formed

·        It has to be structured

·        It has rules that must be followed

·        The syntax is exacting

Sure, this is harder to teach – forget “free will” and “conform” your code, can stump the more creative students, but you are industry ready if you learn it right. Good old slap happy HTML will often work no matter how badly the code is written or formed. This makes it harder to teach because they know they can get away with –

·        A lack of structure

·        No indents

·        Ill-formed code

·        Missing syntax

·        A real “DIY” mentality

Therefore, teaching HTML that works is very easy – teaching HTML that is industry ready is really not!

“Well my webpage works doesn’t it sir?”

“Well…erm…yes, but it is a mess and the code are all over the place and is very hard to follow”

“Whatever, sir…it works and that’s good enough for me, so the heck with it!”

OK, so back to the anecdote – Python.

After getting so frustrated with putting colons and the alike into student’s code, I started playing a game. We had loads of old keyboards at school so I got a load and removed the .,?;:”’ etc from them. If a student asked me why their code wasn’t working, I would look. If it was logic I would explain and work with them on it. If it was syntax, I would go to my desk and pick up the corresponding marked key and place it on their desk. Obviously, if the key they were given was a colon, they knew they had to look for the missing colon in their code. This would encourage them to look for syntax errors themselves, rather than have the embarrassment of receiving a broken keyboard key placed on their desk.

Gosh…I miss teaching Python. However, I love teaching the web trifecta here at The Training Room.

No matter what language you learn – learn to code!

#ttrLearnToCode #ttrIT

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.