---
title: "Coding Classes in Midlothian | Live Online, Ages 6 to 67"
description: "Live online coding, Python and maths classes across Midlothian, from Bonnyrigg, Penicuik and Dalkeith to Mayfield, Gorebridge, Loanhead and Roslin."
canonical: https://learn.modernagecoders.com/coding-classes-in-midlothian
source: src/pages/coding-classes-in-midlothian.html
---
> Live online coding, Python and maths classes across Midlothian, from Bonnyrigg, Penicuik and Dalkeith to Mayfield, Gorebridge, Loanhead and Roslin.

Skip to contentCourses 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.

[![Coding for Kids course thumbnail](/images/kids-coding.webp)Ages 6 to 12Coding for KidsBlock coding with moving sprites, directions and turns measured in degrees.See the syllabus](/courses/kids-coding-blocks-masterclass)[![Maths Through Coding course thumbnail](/images/maths-through-coding.webp)Ages 10 to 15Maths Through CodingAngles, coordinates and trigonometry made concrete by coding them.See the syllabus](/courses/maths-through-coding)[![High School Mathematics course thumbnail](/images/high-school-maths.webp)Ages 14 to 18High School MathematicsSecondary maths in depth, including vectors and the trigonometry of the sun.See the syllabus](/courses/complete-high-school-mathematics-mastery)[![Python Masterclass course thumbnail](/images/python-college.webp)AdultsPython MasterclassPython for adults from the first program to scientific and data scripts.See the syllabus](/courses/python-programming-masterclass-zero-to-advanced-college)

Browse the [course atlas](/course-atlas) for more than one hundred options and use the [coding roadmap](/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.

[![Vibe Coding for Teens course thumbnail](/images/vibe-coding-teens.webp)Vibe codingAges 13 to 17Vibe Coding for TeensPython, web and AI projects where the learner still owns the thinking.See the syllabus](/courses/vibe-coding-for-teens-python-web-ai-projects-course)[![Python Automation Course course thumbnail](/images/python-college.webp)Python and AICollege and adultPython Automation CourseAutomate the work you already do, then let AI carry part of it.See the syllabus](/courses/python-ai-automation-masterclass-college)[![AI and Machine Learning for Teens course thumbnail](/images/ai-ml-teens.webp)AI and MLAges 14 to 18AI and Machine Learning for TeensTrain a model, read what it learned, and be able to say why it is wrong.See the syllabus](/courses/ai-ml-masterclass-teens)[![Codex & Claude Code course thumbnail](/images/codex-claude-code-adults.webp)Agentic codingProfessionalsCodex & Claude CodeRun AI coding agents on real work without losing control of the codebase.See the syllabus](/courses/codex-and-claude-code-ai-coding-agents-masterclass-for-adults-professionals)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.

| Locality | Residents | Locality | Residents |
| --- | --- | --- | --- |
| Bonnyrigg | 18,320 | Loanhead | 6,820 |
| Penicuik | 16,150 | Danderhall | 3,160 |
| Dalkeith | 14,330 | Rosewell | 2,020 |
| Mayfield | 13,690 | Roslin | 1,770 |
| Gorebridge | 8,040 | Bilston | 1,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](/best-coding-class-in-edinburgh). For qualifications, see [National 5 Maths](/national-5-maths-tuition-online) and [Higher Computing Science](/higher-computing-science-help).

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.

| Face | Midsummer | Equinox | Midwinter |
| --- | --- | --- | --- |
| North | 7.6 | 0 | 0 |
| North-east and north-west | 6.8 each | 3.4 each | 0 |
| East and west | 8.7 each | 6.0 each | 3.3 and 3.4 |
| South-east and south-west | 10.6 each | 8.7 each | 6.7 each |
| South | 9.7 | 12.0 | 6.7 |
| Length of day | 17.3 hours | 12.0 hours | 6.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.

| Listing detail | What it records |
| --- | --- |
| Category | A, both dials, added 1971 |
| Date | 1635, carved on the pedestal as A.D 1635 |
| Form | Octagonal sandstone dial, carved in two tiers, on a 19th century pedestal |
| Gnomons | A bronze gnomon in each panel of the lower tier |
| Carving | Initials of William, Earl of Lothian, and Annie, Countess of Lothian, with a sun motif |
| History | An 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 Kids](/courses/kids-coding-blocks-masterclass)[Scratch Coding for Kids](/courses/scratch-programming-complete-course)P5 to S2

### Angles in Python

Typed Python with coordinates, angles and simple charts.

[Maths Through Coding](/courses/maths-through-coding)[Python and AI for Kids](/courses/python-ai-kids-masterclass)S3 to S6

### Vectors and trigonometry

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

[High School Mathematics](/courses/complete-high-school-mathematics-mastery)[Python for Teens](/courses/python-complete-masterclass-teens)Adults

### Science in code

Python for adults, including calculations, data and graphics.

[Python Masterclass](/courses/python-programming-masterclass-zero-to-advanced-college)[Data Analysis Course](/courses/data-analysis-mastery-course-college)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](/blog/is-coding-worth-learning-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 class**USD 0**

One whole lesson for nothing, then our honest advice.

Group tuition**USD 100**

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

Private tuition**USD 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.

Request placement[Check availability](https://wa.me/919123366161?text=Hello%20Modern%20Age%20Coders%2C%20we%20are%20in%20Midlothian%20and%20would%20like%20to%20book%20a%20free%20lesson%2C%20please.)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.

### Contact the team directly

WhatsApp or call [+91 91233 66161](tel:+919123366161), or email [contact@modernagecoders.com](mailto:contact@modernagecoders.com). This is Modern Age Coders' actual contact, an Indian number, and not an invented Midlothian one.

[WhatsApp Modern Age Coders](https://wa.me/919123366161?text=Hello%20Modern%20Age%20Coders%2C%20we%20are%20in%20Midlothian%20and%20would%20like%20to%20book%20a%20free%20lesson%2C%20please.)

Submitted details are used for placement and follow-up.

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](/best-coding-class-in-edinburgh) and [East Lothian](/coding-classes-in-east-lothian), which has a Bass Rock project, or browse all councils on the [Scotland](/coding-and-ai-classes-in-scotland) page. The [UK hub](/coding-classes-in-united-kingdom) covers everywhere else.

Book the free class[Message us on WhatsApp](https://wa.me/919123366161?text=Hello%20Modern%20Age%20Coders%2C%20we%20are%20in%20Midlothian%20and%20would%20like%20to%20book%20a%20free%20lesson%2C%20please.)Free Midlothian class[Call +91 91233 66161](tel:+919123366161)

## Keep exploring Modern Age Coders

### Coding classes in nearby places

- [Coding Classes in Monmouthshire](/coding-classes-in-monmouthshire)
- [Coding Classes in Middelburg](/coding-classes-in-middelburg)
- [Coding Classes in Moray](/coding-classes-in-moray)
- [Coding Classes in Mid Ulster](/coding-classes-in-mid-ulster)
- [Coding Classes in the Western Isles](/coding-classes-in-na-h-eileanan-siar)
- [Coding Classes in Mid and East Antrim](/coding-classes-in-mid-and-east-antrim)
- [Coding Classes in Rutland](/coding-classes-in-rutland)
- [Coding Classes in Roosendaal](/coding-classes-in-roosendaal)
- [Coding Classes in Pembrokeshire](/coding-classes-in-pembrokeshire)
- [Coding Classes in Nissewaard](/coding-classes-in-nissewaard)

### Free resources

- [AI & Machine Learning Tutorial: Basics to Deep Learning](/resources/ai-and-machine-learning)
- [Feature Engineering and Feature Selection](/resources/ai-and-machine-learning/feature-engineering)
- [Introduction to Java](/resources/java/introduction-to-java)
- [Mathematics for Machine Learning](/resources/ai-and-machine-learning/mathematics-for-ml)

### From the blog

- [How to Reverse a String in Python: 5 Easy Methods](/blog/how-to-reverse-a-string-in-python)
- [Abacus vs Vedic vs Mental Maths: A Clear Comparison](/blog/abacus-vs-vedic-vs-mental-maths)
- [Armstrong Number: Definition, Full List and Python Program](/blog/armstrong-number-python-complete-guide-examples-code)

### Start here

- [Try a free trial class with a Modern Age Coders mentor](/free-trial)
- [About Modern Age Coders, teaching since 2020](/about)

---

*Canonical: https://learn.modernagecoders.com/coding-classes-in-midlothian*
