Skip to content
Midlothian

Coding classes in Midlothian

What are the best coding classes in Midlothian?

Midlothian is a council area of about 96,600 residents in roughly 41,000 households, according to the 2022 census, with 273.1 people per square kilometre. Its biggest towns are Bonnyrigg, Penicuik and Dalkeith, followed by Mayfield, Gorebridge and Loanhead, and it includes villages such as Roslin and Rosewell. We teach online in real time from India, and a free first lesson shows where each person should start, whether in P1, S6 or adult life. People aged 6 to 67 learn coding, Python and maths with us, either with a teacher of their own or with five to ten classmates. The Midlothian project comes from a pair of carved sundials at Newbattle. Continuing costs USD 100 a month in a group or USD 150 a month with a teacher to yourself.

In the grounds of Newbattle Abbey stand two identical sundials, each dated 1635 and each listed at Category A by Historic Environment Scotland. The listing describes them as octagonal, carved in two tiers, with a bronze gnomon, the part that casts the shadow, in each panel of the lower tier. Why would anyone build a sundial with eight faces? Because the sun does not stay in the south. On a summer morning it rises in the north-east and sets in the north-west, so a single south-facing dial sits in its own shadow for hours. This page's project turns the sun into a vector in Python and works out, minute by minute, which faces of an eight-sided dial are in sunshine.

Facts last verified 26 September 2026. Teaching is online; no Midlothian branch is claimed.

Courses for Midlothian

Four starting points in Midlothian

A P2 pupil in Bonnyrigg who likes shadows, a P6 in Penicuik ready to type code, an S4 in Dalkeith heading for National 5 Maths, and an adult in Loanhead learning Python. Each starts with a free lesson.

Browse the course atlas for more than one hundred options and use the coding roadmap to check prerequisites.

The four we are known for

Python, AI, vibe coding and agentic coding

These run underneath everything above. Every one is live and online, placed by ability rather than by age, and the first class is free.

Midlothian figures

About 96,600 people in Midlothian

The council total is a rounded first result from the 2022 census, published by National Records of Scotland. Town figures are separate NRS estimates for mid-2020.

Midlothian localities above 1,400 people, NRS mid-2020 estimates
LocalityResidentsLocalityResidents
Bonnyrigg18,320Loanhead6,820
Penicuik16,150Danderhall3,160
Dalkeith14,330Rosewell2,020
Mayfield13,690Roslin1,770
Gorebridge8,040Bilston1,440

Midlothian has 273.1 residents per square kilometre, nearly four times Scotland's 69.8. It is also younger than average: by our addition of the census age bands, 17.7 per cent of residents are under 15, against 15.3 per cent nationally, and 18.9 per cent are 65 or over, against 20.1. Holiday dates are Midlothian Council's to set, and since we have not read them, each family simply tells us theirs.

Edinburgh and exams

The capital has its own page, Edinburgh. For qualifications, see National 5 Maths and Higher Computing Science.

The Midlothian project

Eight faces, one sun, a dot product

Where is the sun, and which way does each face look?

First the learner finds where Newbattle is. The listing gives an Ordnance Survey grid reference, and a standard formula converts it to latitude: about 55.9 degrees north. Next comes the sun. For any date and any hour of solar time, a few lines of trigonometry give the sun's direction as an arrow of length one, with parts pointing east, north and up. Each face of the dial is given its own arrow, pointing straight out from the stone. We assume the eight faces point north, north-east and so on round the compass; the listing does not say. A face can only catch the sun if the sun is above the horizon and in front of it, which the dot product of the two arrows tests: positive means lit.

Our model, hours of sunshine on each face of an eight-sided dial at Newbattle, 26 September 2026
FaceMidsummerEquinoxMidwinter
North7.600
North-east and north-west6.8 each3.4 each0
East and west8.7 each6.0 each3.3 and 3.4
South-east and south-west10.6 each8.7 each6.7 each
South9.712.06.7
Length of day17.3 hours12.0 hours6.7 hours

The surprise is at midsummer. The north face, which never sees the sun in winter, is lit for 7.6 hours: from about 03:20 to 07:10 in solar time, and again from about 16:50 to 20:40. The south face, the one everyone assumes is the sunniest, gets only 9.7 hours, fewer than the south-east and south-west faces, because for the first and last hours of a long summer day the sun is behind it. At the equinox the south face catches all 12 hours of daylight, while the north face gets none. In midwinter, three of the eight faces stay in shadow all day. With eight faces, at least one is always usable whenever the sun is up.

The same few lines also give the length of the day and the height of the sun. At midsummer the noon sun stands about 57.6 degrees above the horizon; at midwinter only 10.7. Our day lengths are pure geometry: real sunrise comes a little earlier and sunset a little later because the atmosphere bends light, so published times are slightly longer. Learners can add that correction as an extension.

Ages 8 to 11

Shine a torch on a paper octagon from different directions and record which faces light up, then code the rule in Scratch.

Ages 11 to 15

Compute the sun's height and direction in Python for each hour of a chosen day and draw them on a chart.

Ages 15 and up

Build the vectors, use the dot product to test each face, convert the grid reference yourself, and add atmospheric refraction.

Real dials, model sun

The dates, carving and paired dials come from the Historic Environment Scotland listings. The face directions are our assumption, and every hour and angle in the table comes from our own program, not from observing the stones.

Why Newbattle

Two carved sundials from 1635

The Midlothian anchor, as its listings record it.

Newbattle Abbey Policies, North Sundial (LB14562) and South Sundial (LB14563)
Listing detailWhat it records
CategoryA, both dials, added 1971
Date1635, carved on the pedestal as A.D 1635
FormOctagonal sandstone dial, carved in two tiers, on a 19th century pedestal
GnomonsA bronze gnomon in each panel of the lower tier
CarvingInitials of William, Earl of Lothian, and Annie, Countess of Lothian, with a sun motif
HistoryAn identical pair, moved from the front of the house to the rear in the mid 19th century

The arithmetic in this project is the same that decides where solar panels go, how buildings are shaded, when a satellite dish loses the sun, and how 3D graphics shade every surface in a game: a light direction, a surface direction and a dot product. A Midlothian student who has found the north face lit on a June morning has learned to test an assumption instead of trusting it.

Historic Environment Scotland and Midlothian Council have no connection with us. The listing details are theirs; the sun model, the assumed orientation and any mistakes are ours.

Learning path

From torchlight to vectors

Stage is a hint, not a rule. The free lesson sets the level.

P1 to P4

Directions and turns

Block coding that moves and turns sprites by angles.

Coding for KidsScratch Coding for Kids
P5 to S2

Angles in Python

Typed Python with coordinates, angles and simple charts.

Maths Through CodingPython and AI for Kids
S3 to S6

Vectors and trigonometry

Vector maths and larger programs beside National 5, Higher and Advanced Higher Maths.

High School MathematicsPython for Teens
Adults

Science in code

Python for adults, including calculations, data and graphics.

Python MasterclassData Analysis Course
AI and assumptions

An AI can compute sun angles in seconds. Will it question the south-facing assumption?

The right formula with the wrong assumption gives the wrong answer.

Ask a chatbot where to point a sundial, a solar panel or a window for the most sun and the stock answer is due south. For the middle of the day that is right; for a Scottish summer morning or evening it is not, as the eight-face model shows. The AI rarely raises the question unless you ask it.

A Midlothian learner who has watched the north face light up at dawn knows to test the assumptions behind an answer, not just the arithmetic. That is the check AI cannot do on its own behalf.

So a Midlothian teenager should still learn to code in 2026, because testing an assumption is harder, and more valuable, than running a formula. The longer argument is in why teenagers should still learn to code in 2026.

How it works

Lessons that reach Penicuik and Gorebridge

Whether in a Midlothian town or village, learners join from home.

A shared screen

The learner writes and runs the code; the teacher sees it live and steps in when something breaks.

Scottish stages spoken

P5, S2, National 5, Higher, Advanced Higher: the same words Midlothian schools use, and teaching in English.

No-cost first lesson

A full lesson, free. Afterwards we recommend a stage and a course, with no obligation.

Five to ten per group

Every group works at one stage, with classmates from several countries.

Term time only

Two lessons a week during term, and none in the school holidays.

Steady UK time

Lessons keep their UK time through the clock changes; teachers in India time take care of the difference.

Why groups are not local

Five Midlothian learners at one stage, free at the same hour, are hard to gather even in Bonnyrigg. Grouping by level across a wider pool gives a learner in Danderhall or Rosewell a well-matched class.

Fees

Fees in Midlothian

Dalkeith or Roslin, the fee is the same, and it matches our fee in every country except India.

First classUSD 0

One whole lesson for nothing, then our honest advice.

Group tuitionUSD 100

About eight lessons a month in a group of five to ten.

Private tuitionUSD 150

About eight lessons a month, one-to-one.

Fees are charged in US dollars, with no sterling price list. Nothing is billed until a course and a weekly time are agreed after the free lesson; the pricing page sets out holidays, missed lessons and switching between formats.

Reviews

Midlothian families and others on Google

Rated 4.9 across 547 Google reviews. These are real reviews, reproduced as written.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

Free placement class

Book a free Midlothian lesson

Share who is learning, how old they are or which stage they are in, and what grabs their attention. A first lesson could be a Scratch game, a Python chart, or the eight-sided sundial on this page.

+44

FAQ

Midlothian questions

Figures, the sundial project, and how lessons run.

How many people live in Midlothian?

Roughly 96,600 residents living in about 41,000 households, as counted by the 2022 census and rounded by NRS.

What are the largest towns in Midlothian?

By NRS mid-2020 estimates: Bonnyrigg 18,320, Penicuik 16,150, Dalkeith 14,330, Mayfield 13,690 and Gorebridge 8,040.

What is the Newbattle sundial project?

Learners model the sun as a vector in Python and use the dot product to find which faces of an eight-sided dial are lit. At midsummer even the north face gets 7.6 hours of sun in our model.

What is a dot product?

A way of multiplying two arrows that tells you how much they point the same way. Positive means within 90 degrees of each other; that is the test for a sunlit face.

How old are the Newbattle sundials?

Both are dated 1635 on their pedestals, according to Historic Environment Scotland, which lists the pair at Category A.

Are lessons held locally?

All lessons are online, so learners from Penicuik to Danderhall join from home.

Can you help with National 5 Maths?

Yes, along with Higher Maths and Computing Science. We teach for understanding and never promise grades.

Who can take lessons?

Every age from 6 to 67. Primary children usually begin with blocks, secondary pupils with Python and exam maths, and adults with Python at their own pace.

What are the fees?

Lesson one costs nothing. From then on, a group place is USD 100 a month and one-to-one teaching is USD 150 a month.

Do you take school holidays off?

We do. Send the holiday dates your Midlothian school has given you and we stop for those weeks.

Nearby pages

Around Midlothian

See Edinburgh and East Lothian, which has a Bass Rock project, or browse all councils on the Scotland page. The UK hub covers everywhere else.

Free Midlothian classCall +91 91233 66161

Keep exploring Modern Age Coders

Coding classes in nearby places

Free resources

From the blog

Start here