Further string manipulation in Python

This post is picking up from the previous entry, examining simple strings and manipulating them within Python.  Previously we looked at a placeholder within a curly bracket:


You can of course use multiple placeholders, and multiple brackets, when you are manipulating strings:


In this case, the order in which the data is transferred to the placeholder, is determined by where they appear in the format method brackets.  So here you can see two placeholders, {0} and {1} – and the contents of the firstname variable will be transferred into the {0} placeholder; correspondingly the contents of the secondname variable will be transferred into the {1} placeholder.

For a fuller explanation see the video tutorial below:

More manipulation of strings in Python

Happy coding!


Talk is Cheap?

Just thought we would put this together in response to :


Feel free to adapt and tweet via @3rdMillLearning 🙂


Simple strings and variables

Hello again, today we are going to be covering the fundamentals of simple strings, and manipulating them so that they display the contents of a variable.  We will also briefly examine the input function.  Let’s take a look at the code:


So here we are printing, or displaying on the screen more accurately, the classic newbie phrase “Hello world”. This is a string, which means a list of alphanumeric characters within quotation marks.  In IDLE they are coloured green. These can be single quotes or double, but try to stick to one format consistently.

We are then being a little more sophisticated because we are introducing a variable.  In a nutshell, a variable is a section of memory that contains something.  It can hold pretty much anything, and it is the most fundamental element of programming, because as the name implies, it is changeable – as a programmer, you can assign a value to it (in this case, and input command) and then you can change it at a later date.  For this tutorial just think of it as a container.

So here the input function (functions are special commands in Python that do key things, and in IDLE they are coloured purple) does a very simple thing.  It displays the string “What is your name?” on the screen, and it waits for you to INPUT (type) a response.  That is it.

The next line then PRINTS (displays on screen) the thing that you typed in when the INPUT prompted you.  What happened there?  The results of what you typed in were stored in the name container (variable), which means that when you referred to the variable in the following print command, it looked inside the variable, found the data you typed in from the INPUT command, and then displays it back to you.  Nice, clean coding.

As we can see, and as is often the case in programming, there are multiple ways to achieve the same goal in coding.  Here, the + symbol adds the contents of the variable to the string.

You can also use a comma to indicate that you want to add the contents of the variable to the string. Note how the comma also puts a space in the text as it is printed.

Finally, this is a little more complex, but you can use another technique to add the variable contents to the string.  This is using the format method.  This is in fact the more sophisticated way in this case to add the variable contents to the string, which is why it looks more complicated.  You can do much more with it, such as left or right justifying, and you can manipulate the string much better than using + or , which is why it is considered more Pythonic, as many Python coders say. It uses little curly brackets as a sort of placeholder – so here, putting a {0} is essentially telling Python to put a little bookmark in that part of the string, and to wait for some data.  The data comes with the method .format, and the then the (name) variable.  So the code here waits until it checks what is inside the formatname variable, then puts it into the curly bracket 0 bit of the string.  Many ways to do the same thing.

We will cover many more string manipulation techniques in future posts.

Happy coding!

New to Python? Look no further…

There is an ever-increasing interest in the Python programming language.  The reasons are multiple – it is a nice, English-readable high-level language (as opposed to, for example, C#).  It is also easy to get up and running with it because it is bundled with IDLE.  You can access a Python programming environment online, through wesbites such as CodeCademy, or Trinket.  Finally, there are a large number of resources available to budding Python programmers.

Nevertheless, there seems to be a dearth of really tight, accessible videos that explain Python to the newbie – so Third Millennium Learning is launching a series of YouTube videos that do just that.  The first two can be found here, and there will be plenty of updates as the weeks and months roll by:

Introduction to Python and IDLE





Introduction to using Trinket to code Python


Happy coding!

Millennial Leadership in schools

Pollie Massey recently wrote an article for Forbes, which looked at the changing face of leadership within the business world.  Massey notes that  Millennials (born between 1980 and 2004) make up one third of the US workforce at the moment, and that figures is set to increase to 50% by 2020.  At the moment, Baby Boomers and Generation X members are heading up these organisations, with the Millennials performing entry to mid-level tasks; clearly this will change as our workplaces are flooded with Millennials and members of Generation Z.  The UK picture is reflected in the following graphic, courtesy of culture-time.com:



The picture is not entirely dissimilar in UK schools – the vast majority of senior leaders are still Baby Boomers or members of Generation X (including me) – and according to a number of reports we will be facing a significant shortfall of leaders in schools by 2022.  One such report is found here, and interestingly it touches on the same themes of diversity as Pollie’s article.  There are numerous analyses about why such a crisis is looming, not least the continually changing expectations of a variety of Governments and examination boards, pressure of work, and media portrayal of teachers.  I have been in this profession for 19 years (which explains why I am a member of Generation X of course), and there are some good suggestions in the School Leadership Challenge 2022 article, including recruiting more BAME groups, increasing the number of women in senior leadership roles, and a ‘shift of culture’ which includes identifying and mentoring potential leaders in a much more tactical way.  None of which I disagree with.

However the thing about a ‘shift of culture’ is – it already shifts all by itself, especially as Millennials and Generation Z teachers appear in increasing numbers.    These teachers bring a whole different attitude to work and life – they are digital natives, or even ‘technoholics’ – expecting digital platforms to simply work for them all of the time, exactly as they expect, and entirely comfortable in digital worlds.  Their attitude towards their career is much more two-way – Millennials are happy to work ‘with’ a school, not necessarily ‘for’ the school.  Members of Generation Z will flit between schools, industries and countries – this is not disloyalty, it is simply the way things are for them.    This is in stark contrast to current school leaders, many of whom are loyal to a particular school, or at least to a career within teaching itself.

(On a separate note, the students we are currently teaching have needs that one could argue are not being fully met by the contents of their lessons alone; needs that are reflected in a number of reports such as this one, but that is a topic I will return to in a separate post)

As Massey notes, Millennials place great value on relationships (online or offline), so any coaching  and mentoring programmes need to account for this.  She also notes that Millennials will bring different, innovative perspectives to organisations – they may well end up reimagining the entire organisation given time.  (they have time of course – much more than we do). Finally, Millennials expect there to be an authenticity and transparency to what the organisation is doing amongst the community – this is a vital element for any school, and one that is frequently overlooked by Baby boomers and members of Generation X.

Only by recognising this shift in culture, this inevitable shift that is happening now, and that will continue to accelerate whether my generation likes it or not, will we be able to prepare school leaders for 2022 and beyond.  The future, as always, could be very bright indeed – driven by the next generation, with plenty of mindful prompting and mentoring from generations such as mine.

The full report pertaining to the School Leadership Challenge 2022 can be found here.


Will Tech be Trumped?

Amid the shock, the genuine shock, the mind-befuddling miasma of events that led to the the designation of Donald Trump to the role of President-elect…let me just pause a while to let that sink in…

Amid all of this is the fear that Technology, particularly in the US, could take a pummelling.  Techcrunch nicely sum up the state of play here:

Here are the tech policies Trump promised to implement as president

There is a powerful image at the beginning of the story of Trump bellowing out  140-character snippets of whatever his mind has, er, alighted upon – to “tremendous young ladies”, who presumably perform some sort of spontaneous insta-tweet within seconds of coming aware of being yelled at by the President-elect.


‘Big’ companies and ‘big’ concepts also need to take note – Trump does not trust China (as well as being un-American they also invented the lie of Global Warming) and therefore wants Apple to relocate their manufacturing sector to America.  That also includes Oreos and Ford cars, people.

Did I mention Global Warming?  It’s all tosh, a hoax, propagated by those un-American Chinese folk in order to kill US manufacturing.  We fancy-dan Europeans are buying into this hoax presumably.  Silly us.

Amazon beware – Bezos dares to own a Clinton-supporting paper (The Washington post was bought when it was on its uppers and has now been turned around by Bezos into a massively successful online news source), and Bezos had better watch out because Trump wants to claim Space back – no doubt swatting Blue Origin out of the way as NASA races to something like Mars or Jupiter.  Somewhere like Outer Space.  Not Inner Space.

Net neutrality – that fundamental concept of a free-for-all internet – Trump wants that.  America did, after all, create the net as a military network back in the days of Arpanet.  So hands off you woolly-minded neo-liberals.  Unfortunately for Trump he might be agreeing with China here.

Cyber itself – that cyber problem – he’s going to take it on, full steam.  He is worried about the security aspect of cyber.  Cyber what? Cyber Clinton emails?  Cybermen?


See how the French are quite happy to embrace cyber in all its’ forms?  I am certain that Trump will do plenty to tackle the French cyber issue.

What does it all mean?  What does Trump mean?  I cannot tell you.  Is he somebody who has cleverly traded in fear and paranoia and will soon resume office, surround himself rather sensibly by advisors who know what they are talking about, and morph into some sort of angry version of Reagan?  I never saw Reagan look angry so that concept itself is a strange one.  Or does he genuinely have these opinions?  And will these opinions actually turn into policy?  Should I be bothered given that I am an Englishmen, and is it really an echo of Brexit?  Or something much worse?

I still have the image of Trump shouting at tremendous young ladies revolving around my head, and that will take some time to clear.  If I have inflicted it upon you, and if you voted for Trump, well, you reap what you s0w.


year9_success = quantum + computing * python

Our school is taking part in the BBC Schools Report which goes live on 19th March, and I asked some of our Year 9 girls to summarise the two terms of Computing that they have experienced so far since September.  What they wrote was really very enlightening and encouraging, so rather than try to produce a precis of it, I would rather reproduce it in whole below.  What our Year 9s do know is that I am immensely proud of what they have achieved this year, and of what they will go on to achieve.

What we have been learning in Computing @BHSfG – Year 9

In ICT this year, we have been learning how to program in Python using Codecademy, which is the first time most of us had approached this sort of learning platform. We only knew basic information about coding e.g used to create software, but knew nothing about how to code. Now after only a few months, we know the fundamentals of coding and can program a simple questionnaire, which is a great achievement after knowing only a small amount, if not nothing about coding. We are now going a step further than Codecademy and are using ‘ Python Idle’ to program.

This will help us in the future, as many jobs in  will be orientated around computers and STEM, and even if we choose not to go into computing as a career, it will prove extremely useful in almost any job we might choose to persue.

And also if we wanted to go into any jobs like a computer programmer or a computer scientist, we will already have a head start on the other people training for this job, as we have been taught it from a young age.  An example of some of our programming code is below – and it is certain that if we had looked at this code even six months ago, we would not have had any idea what it means!

Python programming - Battleships

We have also been studying Quantum computing, and quantum entanglement and how when particles become entangled in the Quantum world, then one does the complete opposite to the other. This can be explained in more detail in the famous thought-experiment from Schrodingers, known as Schrodinger’s Cat. If you have one cat in a box which contains poison and close the lid, you don’t know if the cat has eaten the poison or not, so all the time the lid is shut, it is BOTH alive and dead at the same time! At this moment in time the cat is in a state called a Superposition. For example, if you put two separate cats in separate boxes (must be entangled) and you open one box the cat will be alive, and if you open the other, it must be dead. When one box is opened and the cat is observed, the cat changes from being in the state of superposition to being either dead or alive. But this defies the laws of physics, space and time!

We learnt that in classical mechanics there would be four outcomes. If we had two boxes with a cat in each box The cats could be:

  • Alive or Alive
  • Dead or Dead
  • Alive or Dead
  • Dead or Alive

However, in Quantum Mechanics there are only two outcomes:

  • Dead or Alive
  • Alive or Dead

This is all because of the fact the cats are Quantumly Entangled, and in Quantum Entanglement one object has a direct relationship with another one, which results in the two objects having opposite states – they cannot both be the same.  So here, the cats cannot both be alive at the same time, or both dead at the same time – they must have opposite states.  You can apply this to the binary world, so instead of dead-or-alive cats, we have binary digits (bits) which are either 1 or 0.

More recently we have been learning how Quantum Entanglement will be able to achieve extremely faster computers using qubits. When bits can both be a 1 and a 0 simultaneously, we call them qubits.  A qubit is much more powerful than just a regular bit – which is either a 1 or a 0 but cannot be both at the same time!) Using quantum entanglement, a quantum computer will be able to entangle the qubits so that they have a relationship to each other, and can hold an exponential number of multiple states!, Therefore computers will be able to simultaneously do millions of jobs or calculations simultaneously. We have been shown an example of a Quantum Computer, which is called D-wave, that has 300 qubits, and the plan is that before long it will have more computational power than the number of atoms in the visible universe!

All of this is at the cutting edge of both physics and science, and we realise that this technology has not yet been fully realised.  However it is fascinating to learn about the potential that Quantum Computing offers, and alongside our improving programming skills, we feel that Burgess Hill School for Girls is really equipping us for this exciting future.

Megan, Issy, Jazz, Elvie – Year 9