FOR generations children have been told the sky's the limit if they work hard at school, but one group of high-flying pupils are reaching for the stars.

The UK Space Agency has announced a computer program written by Thirsk School year seven and eight students overcame competition from 1,000 pupils nationwide to win a contest to provide scientific experiments for the International Space Station, where the application will be used to gather data on board.

Major Tim Peake, who will become the UK's first astronaut in two decades later this year, will take a credit-card sized Astro Pi computer on a six-month mission to the station, featuring the program by the 12 and 13-year-olds.

Alongside preparing for a space walk, the former Army Air Corps officer will set the experiment running and download the data to Earth, where it will be distributed to the students.

Ten Key Stage Three children spent their lunchtimes for seven weeks writing 56 pages of code for the program, which will use orbit information to determine the country the station is flying over, display the flag of the country and a short phrase in the local language.

The program has been assigned an operational code name that will be used when talking about it over the space to ground radio.

The programming involved the students grappling with telemetry data provided by North American Aerospace Defense Command (NORAD).

Winners in the Key Stage Four competition designed experiments to measure the health of plants and study how crew’s reaction times change during a lengthy mission, while the Key Stage Five pupils created a cosmic ray detector.

The judging panel said it had been impressed by the quality of the Thirsk students' work, the results of which were useful, well thought through and entertaining.

Jeremy Curtis, the UK Space Agency's head of education, added: "Not only will these students be learning incredibly useful coding skills, but will get the chance to translate those skills into real experiments that will take place in the unique environment of space.”

Dan Aldred, the school's head of computing, said the program had been generated from ideas by the pupils, who were interested in whether the station's crew would know where they were if they didn't use flight instruments.

He said: "It is a massive achievement and I am extremely proud of their dedication and determination.

"It just goes to show what an amazing thing learning to code can be - it can literally open up new frontiers."