When the coronavirus began racing around the globe this spring, Katie Ledecky couldn’t find a swimming pool for training and saw her competition schedule wiped clean through the summer and beyond. To focus on the Olympics, she was in the midst of an extended break from her studies at Stanford, but when the Tokyo Games were postponed, the 23-year-old suddenly had some time on her hands.

So Ledecky re-enrolled in classes as a way to keep busy as the world around her shut down. She took a full load of classes in the spring, summer and fall, and in November she completed all of the coursework for an undergraduate degree in psychology. It was a silver lining of sorts to the pandemic that seemed to upend just about everything else.

“It was busy, and it was challenging,” Ledecky said in a phone interview last week. “But it also gave me something to do and something to focus on. There was definitely the side benefit of keeping my mind occupied during this time.”

Even with a 12-month break from classes, Ledecky wrapped up her bachelor of arts degree in a little more than four years. Ledecky said that if the Tokyo Games had taken place as scheduled this summer, she wouldn’t have finished her studies before the end of 2021 — and probably later.

“Once most of the classes went online and the Olympics were postponed, I figured it was a great opportunity to get going,” she said.

Ledecky took a gap year after graduating from Bethesda’s Stone Ridge School in 2015 to prepare for the Rio de Janeiro Games. She arrived on Stanford’s campus just a few weeks after winning four Olympic titles and competed for the swimming team for two years before turning professional in March 2019.

She continued training alongside her former teammates at Stanford with Coach Greg Meehan and knew she would complete her degree.

“Ever since I took that gap year, I think I’ve believed in the benefit of kind of going at your own pace and really being all-in on learning when you’re in the classroom and not trying to rush through,” Ledecky said.

As she worked to complete her degree, she took a class this spring called “Global Change and Emerging Infectious Disease,” just as the coronavirus came to dominate and dictate most every aspect of daily life. “What better time to take that class?” she said.

As the presidential election dominated headlines and national conversation in the summer and fall, Ledecky loaded up on political science courses to fulfill requirements for her minor.

Ledecky often has spoken of the importance of education to her and her family and recently launched initiatives to encourage young people to pursue STEM fields (science, technology, engineering and mathematics).

Ledecky said her formal education will continue beyond her bachelor’s degree. She plans to continue her studies — perhaps business school or law school — in the near future.

“I don’t know exactly what area I want to go into,” she said, “but I want to explore some of these interests that I’ve developed over the last couple of years.”

With schoolwork complete, Ledecky is locked in on training for Tokyo, where she is likely to take aim at five medals. She skipped last month’s U.S. Open, the first major American meet in more than eight months. Along with her Stanford teammates, Ledecky competed against the California swim team twice in November, her first live competition since the TYR Pro Swim Series event in Des Moines in February.

“It’s been nice to have those opportunities to race next to some people that you know aren’t your teammates,” she said.

There are four Pro Swim Series meets scheduled for the first half of 2021. Ledecky would like to race as often as possible, but health and safety concerns promise to dictate all of her decisions. The first meet is scheduled for mid-January in Richmond.

“We’re kind of taking it step by step, and things change so much that it’s hard to plan really far in advance,” she said. “You just want to make sure that you get everything in place to keep yourself safe and keep others safe. So we’re just taking a cautious approach.”

As for formally receiving her degree from Stanford, Ledecky isn’t quite certain. The school’s graduation ceremonies are scheduled for June — at the same time as the U.S. Olympic trials. If the ceremony is a virtual one, Ledecky said she would like to take part.

“But it might be from a hotel room in Omaha,” she said.