Medha Gupta sometimes felt uneasy making the 20-minute walk from the corner where the school bus dropped her off to her home in Herndon, Va. — especially during the colder months, when it would get dark early.

Her mother had a suggestion: Write an app.

Divya Gupta was half-kidding, but Medha, a sophomore at Fairfax County's Thomas Jefferson High School for Science and Technology, took the challenge seriously.

So she went to work.

"I knew I had a problem I needed to solve," said Medha, 16.

The result was Safe Travel, an app designed by Medha to help commuters feel more secure when traveling alone. Using their iPhone (the app is compatible only with iOS), a person can program it to send an alert to someone they trust if they fail to arrive at a destination within a certain time.

It was the first iOS app that Medha had created. It's a program language she wasn't well-versed in, so she didn't think much would come of the project. But her inaugural effort caught the eyes of judges for the annual Congressional App Challenge, who selected her as the winner for Virginia's 10th District.

"We were elated," said her father, Manmohan Gupta, who has a computer engineering background.

The App Challenge is designed to encourage students to consider careers in science, technology, engineering and math by experimenting with coding and computer science. It is modeled after the Congressional Art Competition, where student artists compete to have their works displayed at the Capitol. Once exclusive to high school students, the challenge was opened in 2017 to students in grades K-12 across the country.

"This contest is about building the domestic pipeline for the jobs of the future," said Rachel Decoste, executive director of the App Challenge.

This year, more than 4,100 students submitted nearly 1,300 apps. One winner is chosen for each congressional district that participates. Medha beat out several other competitors in Virginia's 10th District, which is represented by Rep. Barbara Comstock (R-Va.).

"We are always delighted to see the innovation and talent that our students demonstrate through the annual Congressional App Challenge," said Comstock. "It is this kind of skill and innovation which makes this contest so rewarding each year."

The app challenge is an initiative of the U.S. House of Representatives, but is managed by the nonprofit Internet Education Foundation. Winning students are invited to attend a reception on Capitol Hill in April and also received $250 in Amazon Web Service credits. (Jeffrey P. Bezos, the founder and chief executive of Amazon, also owns The Washington Post.)

"It's really interesting to see the different apps these kids come up with," said Troy Murphy, public policy manager with the Northern Virginia Technology Council, who served as one of the judges for the competition.

He said while the entries were all impressive, he ultimately voted for Medha's app because it "dealt with an important, pressing problem."

Murphy said he also was impressed by Medha's technical expertise.

Decoste said that students who enter the challenge are encouraged to think creatively and can work individually or in teams. Some have created games, and others, like Medha, have tackled health and transportation issues. An all-girl team from Arizona created Teens for Political Action AZ, which is designed to bridge the gap "between the intimidating political jargon and teens looking to become more involved and aware of the issues affecting themselves, their community, and their country," the challenge's website states.

"It's whatever they come up with," Decoste said.

Medha didn't have the congressional challenge in mind when she designed her app. Like many other tech-savvy teens, she said she's always thinking about how she can use technology to solve everyday problems. She's already familiar with several programming languages, having participated in "hackathons," where students come together to tackle problems using technology.

She said it also helps that she's a bit "obsessed" with her iPhone. But that obsession comes with an upside: the desire to understand what powers the apps that she finds so addictive. It's just who she is.

"Since I'm so obsessed with my phone, I wanted to learn how each app runs and what goes into creating them," Medha said.

Designing the app meant squeezing it into an already jam-packed schedule of Advanced Placement classes and after-school activities that range from studying Indian classical dance to teaching young students how to code. Some days, she skipped lunch with her friends at school or spent nights curled up in a comfy chair or sofa in her family's home typing furiously on her laptop.

"I thought she was on Facebook," Divya Gupta told a visitor, laughing. "She was sitting there for hours."

"Mom, I was working," Medha shot back with only the slightest of eye rolls.

Medha said it took her about 40 hours to design, program, test and troubleshoot the app.

Her app is not available for download; she'd have to pay a fee to do that. But she doesn't rule out offering some version of it in Apple's App Store in the future.

As for her next app? Medha's not certain. She's temporarily put her app-development ambitions on hold because she's busy teaching herself artificial intelligence with an eye toward writing an algorithm to help police hate speech on Facebook. Yes, she knows that there are teams of Facebook engineers probably doing the same thing. But she figures it can't hurt to do her part too.

"If we see something wrong with the world, we should do something about it," she said. "After all, the only one stopping us from doing something is ourselves."