STOCKHOLM — Patricia Sjöberg, an elementary school teacher in the Swedish capital, is not a coder.

But when her 9-year-olds started to pepper her with questions about how to wirelessly control Lego windmills in a recent math class, she soon found herself trying to decipher digital coding on the kids’ tablets to make the mini blades spin and whirl.

“I’m learning just as they are,” said Sjöberg, who teaches at a 1,000-pupil school in a neighborhood in southern Stockholm. “We’re doing this together. You just have to throw yourself out there.”

Similar scenes are now playing out across this country of 10 million people, as Sweden rolls out a digital reboot to its nationwide education system. Faced with heavy competition from the United States and China, the tech-savvy nation is hoping its new programming and digital literacy courses will give its students a new competitive edge.

The Nordic country is trying to hit the digital jackpot for the second time.

“Suddenly you have hundreds of schools that now need to do this. It’s a critical moment" — Fredrik Heintz, computer science professor at Linköping University

Roughly 30 years ago, government officials rolled out a nationwide subsidized computer and internet broadband program, giving even the poorest of Swedes access to costly digital tools that, for many elsewhere, were out of reach.

That investment is credited with nurturing a generation of digital savants, some of whom went on to help build tech giants like Spotify, the global music-streaming service, and King, the online gaming company behind mobile hits like Candy Crush.

Now, Sweden faces a tougher challenge: keeping up its digital momentum.

Others will be watching closely. Lawmakers, teachers and education policymakers worldwide are grappling with the same challenge: how to ready students for a digital world in which technologies like artificial intelligence are changing faster than people can upgrade their smartphones.

Advocates stress that spreading digital skills across the country’s curriculum — from science and math classes to social studies and religion courses — will be crucial if the

next generation of Swedes is to succeed in an ever-more connected world.

Others doubt whether the country’s schools — many of which remain under-resourced and lacking digitally skilled teachers — will be able cope with the high expectations of training kids to succeed in the 21st century workforce.

“Suddenly you have hundreds of schools that now need to do this,” said Fredrik Heintz, a computer science professor at Linköping University, a two-hour drive south of Stockholm, who advised on the digital upgrade to the national curriculum. “It’s a critical moment.”

Staying a step ahead

Sweden is starting its digital reboot on the front foot.

With widespread access to high-speed internet access and a well-educated, mostly tech-literate population, the country is already one of the world's most vibrant digital ecosystems , including placing third — behind Singapore and Finland — in the World Economic Forum’s “Network Readiness Index,” a global ranking of digital preparedness.

But with technology becoming increasingly central to how people live, work and relax, local policymakers want kids as young as six years old not just to be “ready” for a truly digital economy — but to be able to stay one step ahead of it.

That involves a new curriculum prioritizing digital skills, introducing coding in math and science classes and promoting online literacy and critical thinking in social studies and religion courses. Little, if any, new funding has been made available for the nationwide rollout, though Stockholm has funded coding courses for roughly 3,500 (mostly math) teachers.

The goal is not just to teach students the basics of programming — a skill that is in high demand worldwide — but also to help them spot potential digital falsehoods shared through social media.

“We need students to be aware about what’s happening online,” said Christian Magnusson, director of education at Sweden’s National Agency for Education, and the main architect of its digital push. “Every day decisions are now made by algorithms. Kids need to know what’s going on.”

Digital skills reboot

Magnusson, a soft-spoken bureaucrat, was tasked with identifying the skills the next generation will need to thrive in a digital world — one where learning basic coding and deciphering mistruths online are as critical as memorizing multiplication tables and gaining foreign language skills.

Like everything in egalitarian-minded Sweden, his eventual plan — which was proposed to lawmakers in 2016, adopted a year later and made mandatory in August — centers on giving all students equal access to these digital tools.

“One of the main purposes of the reform is to reduce the gap between those who are ahead and those who are behind,” Magnusson said in a recent interview at the ministry, housed in a 1960-style brutalist building in central Stockholm.

It’s not an easy task.

While the Nordic country has some of the highest living standards anywhere in the world, its population — on par with that of Michigan — is spread across almost twice the area. Many of the more-sparsely populated areas in the north remain relatively under-funded and under-resourced compared to their southern counterparts, notably those in Stockholm.

Sweden’s decentralized education system also means cash-strapped local municipalities, not the national government, are in charge of the reboot of the education system. That means basic tech infrastructure like high-speed internet and computer access — not to mention access to qualified teachers — can vary markedly between neighboring cities.

“It differs a lot between schools,” said Annika Agélii Genlott, an official at the Swedish Association of Local Authorities and Regions, who is in charge of creating a national plan to help municipalities handle the new curriculum. “A lot depends on the principal and teachers.”

It’s not just coding

Kalle Enström is better placed than most Swedish principals when it comes to tackling the reforms.

As the head of one of Stockholm’s most digitally literate schools — he has two full-time IT experts at his disposal — Enström has spent years preparing his school for a digital push by retraining his staff, reworking the curriculum to focus on digital skills and buying new equipment.

“We will have to step it up,” he said in one of his tech-focused classrooms, complete with high-speed Wi-Fi access, more than 30 iPads and two 3D printers. “Before, there was room to see how things played out, but now it’s all mandatory.”

In a recent class, the policy reforms came face to face with the realities of everyday teaching.

Martin Fernström, a fifth-grade math and Swedish teacher, asked his cohort of 10-year-olds to figure out the sequence of movements of a fellow student, who he had directed — partly in Swedish, partly in English — to walk around the room following a set of instructions.

The goal? To learn that one action led to another, a basic requirement for digital programming. “You want to use it as a problem-solving tool,” said Fernström as his students practiced the rehearsed movements around the classroom. “You have to see it as an opportunity.”

But the focus is not just on programming.

Enström and his 80-person staff teach students — between the ages of 6 and 16 — about critical online thinking by encouraging them to write stories on their tablets to hone their language skills, create book covers for their projects in art class and then upload them onto a custom-built online library where anyone can read, download and write reviews of the students’ work.

Kids are also helped to promote their e-books through social media as if they were real authors, as well as taught how to respond to potentially negative reviews in ways that offer real-world examples for often complex topics like digital misinformation and online trolling.

“We want them to understand this is how they can get their view across online,” said Micke Kring, the school’s main tech adviser, who also built a YouTube-style online video portal , so that students could upload TED-talk style presentations and podcasts to share with friends and family. In total, the students’ projects have been viewed and downloaded hundreds of thousands of times, as well as used by other Swedish schools with fewer resources at their disposal.

Teachers key to success or failure

Even for Enström, the new project is a challenge, shedding light on the roadblocks faced by schools with less experience and funding to implement the digital tools.

The national government provided minimal additional funding to help schools prepare, so Enström had to rejig his yearly budget, making tough decisions about what equipment to buy and what traditional courses to cut back on.

Over coffee in between classes, he also worried openly for his older pupils, who have not benefited from years of mandatory digital training, but who will now be graded on their ability to code, critically assess online material and the other new requirements.

“We can’t bridge the tech cap for the older kids,” Enström said. “We’ll do what we can for them.”

Much of the program’s success will depend on teachers — like Patricia Sjöberg struggling with her Lego windmills — buying into the revamp.

Only one in five Swedish math teachers currently know anything about coding, a figure that falls even lower for those teaching non-technical subjects, according to union statistics.

Some experts and teachers worry that already overworked teachers do not have the capacity or willingness to keep Sweden’s students on the cutting edge of digital advances, hamstringing the country’s efforts to maintain its place among the global tech elite.

“Digital skills are changing the global context, we need to be thinking in new ways" — Peter Bragner, Stockholm schools official

“Some are pretty bitter,” said Karin Nygårds, a local teacher who created TeacherHack, a website with digital tools and examples to help others. “Teachers see it as just another thing laid upon them.”

Yet as the digital reforms are now mandatory, school officials counter that it is up to teachers to embrace the reforms, noting that digital skills must be included in all classes — from math and science to language courses and social studies — so that technology is not siloed as a separate subject.

“We don’t have exams in electricity or in water, why should we have exams about technology?” said Peter Bragner, an official with Stockholm’s municipality who oversees 22 schools in the Swedish capital. “Digital skills are changing the global context, we need to be thinking in new ways.”