BY ALL OUTSIDE APPEARANCES, Reshma Saujani was a success. A graduate of the Harvard Kennedy School and Yale Law School, she had become a corporate lawyer for a Wall Street hedge fund by age 33, reaching a pinnacle her immigrant parents could only have imagined. Inside, however, she was despondent, feeling like she’d sacrificed her youthful ideals at the altar of paying off her student loans. “I was working in an industry that was foreclosing on people’s homes,” she says. “I was miserable.”

So she decided to take dramatic action—declaring her candidacy for U.S. Congress from New York in 2010. While she had had some experience raising money for the likes of John Kerry, she’d never run a political campaign, or even been on television before. Still, right up to Election Day, she thought her passion would carry the day. “I thought I could shake every hand and I would win,” she says. “I didn’t know any better.” When the returns came in the Democratic primary that night, Saujani had lost spectacularly, 81 to 19.

Despite some initial disappointment, however, Saujani says she was elated. “It was the most amazing year ever,” she says. “I learned that failure doesn’t break you—that it’s better to live a life without regrets, and I wasn’t doing that.” And she learned something more besides. As she campaigned in New York City schools, she observed a persistent gender gap in computer science classrooms. The realization led directly to founding Girls Who Code, the nonprofit she now runs to teach girls computer skills. But just as importantly, it teaches them lessons that Saujani has always naturally seemed to exude: that good things happen when we are brave.

Girls were afraid to show their code because it wasn’t perfect. Rather than say, ‘I don’t know how to do this, can you help?’ it was perfection or bust. Reshma Saujani MPP 1999A certain rebellious streak had been in Saujani’s nature, developed as a child from the stories about her parents’ immigrant past—even if her choices didn’t always endear themselves to her parents, who came to the United States from Uganda in 1973, refugees from a crackdown on Ugandans of Asian origin by the dictator Idi Amin. In suburban Chicago, her father worked two jobs but always found time to read to her at night. “He would read me all these Reader’s Digest books about historical figures like King, Gandhi, and Roosevelt,” she says. “It inspired me to be one of those girls who wanted to change the world.”

She started a multicultural club at her high school in the 1990s and joined Model UN and the debate club. While attending college at the University of Illinois at Urbana-Champaign, she noticed that all the politicians she admired seemed to have attended Yale or Harvard, so she set her sights on an eastern Ivy. Disappointed when she failed to get into law school, she saw a flyer in the college guidance office for the Kennedy School. “I was like, public policy—that’s me.”

Far from being proud, her parents were infuriated. “They didn’t see it as the ‘real Harvard,’” she says. “In an immigrant family, you have to be a doctor or a lawyer or an engineer. It was my first rebellious move.” Although she was disappointing her parents, however, she felt she was honoring what they had sacrificed for. “Seeing them come to this country as refugees, not having family, and leave everything behind just for a change for their children was inspiring to me,” she says. “I was always moved by creating opportunities for others.”

Her instincts paid off for Saujani, who was suddenly attending talks by JFK Jr. and Benazir Bhutto. She took every advantage of the situation, says her classmate Kendra Goldbas MPP 1999, who is now the West Coast director of recruiting for McKinsey. “She was just a sponge in that environment,” Goldbas remembers. “She would always be coming back from another part of campus; we’d get together for a drink, and she’d be coming back from the law school or the business school.” Saujani did her academic research on South Africa, spending time in the country right after the end of apartheid. “That was my second rebellious move,” she says. Again, however, she felt she was honoring her parents in spirit if not in name. After all, if Indians in Uganda had had political representation, they might not have had to leave. “The thought of how you can get your rights and property taken away from you in an instant was really profound for me,” she says. “I always felt it was important to participate and get involved.”

Her political involvement took a back seat for the next decade, while she attended Yale Law School and began her Wall Street career, putting her back in the good graces of her parents. When she did finally run in the Democratic primary, against the longtime incumbent Carolyn Maloney, she embraced her financial background—urging more partnerships between Wall Street investment firms and technology companies in order to create jobs—along with immigration and education reform. “This was a time when there was an enormous amount of anti-incumbency feeling in the country,” says her friend Trina DasGupta, a cultural content producer who worked with Saujani on Kerry’s campaign. “There were a lot of people who believed in her; there was this feeling of this woman is going to do amazing things.”

Girls Who Code Clubs are free after-school programs and part of the organization's plan to maximize their reach. At this Girls Who Code club in Montclair, New Jersey, (founded by two computer science students from local colleges) girls ranging in age from 12 to 18 worked on projects such as apps for viewing unicorns and a Lego robot with a sensor for sorting colors.

Even after losing that race so badly, Saujani didn’t give up on politics. She began working for the then public advocate (now mayor) Bill DeBlasio as a deputy. In 2013, she ran—again unsuccessfully—for public advocate herself, this time placing third in a five-person race. All the while, however, another idea was percolating in the back of her mind. “I would be invited to talk to schools, and I would walk in and say, ‘Why are there all boys in the computer science classrooms?’ ‘Why are there all boys on the robotics team?’” She heard her father’s voice in her head—that in order to be successful, one had to be a doctor, a lawyer, or an engineer—and wondered where the future female engineers were going to come from.

So Saujani put her Kennedy School training to work, coming home every night from her job to strategize about how to get more girls involved with computers. “I looked at it as a policy problem,” she says. “First you analyze it, you get data, and you put together an idea for an intervention.” For a year and a half, she interviewed computer professionals about how one might teach girls to learn computer code, conceiving of a summer program that would take place at a tech firm, where they could not only learn the skills they needed but also see examples of real, live computer programmers at work. Settling on 20 participants to start, she personally recruited a diverse group of girls for a pilot program, paying them $50 each to take part.

Launched in the midst of her second political race, the program was an instant success, with students thriving in an all-female environment. “In my campaigns, I never got a break,” Saujani says, “whereas with Girls Who Code, it was all hearts and rainbows. It was clear the world wanted this.” What she didn’t anticipate, however, was that girls, given the chance, would tackle coding so differently from boys. At the end of each session, each girl would take on an individual project of her choice; whether it was biologically or socially conditioned, girls came into class with a desire to use computers to change the world. “Cora wanted to build an algorithm to detect whether a cancer tumor was benign or malignant, because her father had had cancer,” Saujani says. “Leslie wanted to build a way for Latina entrepreneurs to connect. They were not trying to build a new shooter game, they were building something about climate change or a pet finder.”

Another graduate of the program, Caseein Kelly, grew up with a single mom in the Bay Area. She was always interested in technology but intimidated by the lack of girls in computer classes in her school. When she proposed projects such as an app to organize your closet, she felt ostracized by the boys, none of whom wanted to be on her team. At Girls Who Code, she found a supportive environment and ended up developing a project that used sentiment analysis to identify implicit bias in Wikipedia and newspaper articles. “I never thought I’d be able to do something like that,” she says. “They really build you up so you don’t even realize you are learning so much.” Now a computer science major at Harvard, Kelly interned with the Greek government this past summer, using her technology background to help develop tourism policy. “Through Girls Who Code, you realize you can use computer science to work on government policies and have an impact on issues,” she says.

Even so, Saujani saw serious hurdles that girls needed to overcome. As she spoke to instructors in the program, they kept telling her the same story: Girls would say they couldn’t solve a problem, and their screens would be blank. But when the teachers hit “undo,” they’d find that actually the girls had worked through the problem and come close but then deleted it. “Girls were afraid to show their code because it wasn’t perfect,” Saujani says. “Rather than say, ‘I don’t know how to do this, can you help?’ it was perfection or bust.”

Part of what was so magical was that once they crossed that hurdle, learning code was symbolic for bigger things in their livesShe found, however, that once girls sat with a problem and were able to solve it, their sense of accomplishment would have a ripple effect. “Part of what was so magical was that once they crossed that hurdle, learning code was symbolic for bigger things in their lives,” Saujani says. “Instead of feeling like an idiot, they found that if they could take the time to figure something out, it changed their entire perspective about how they learn.”

That was the case for Joelle Robinson, a teenager from Queens who discovered Girls Who Code six years ago, while she was in middle school. She had an interest in both performing arts and engineering, but felt pressure from other students to downplay the latter. “I was labeled a ‘nerd,’ or whatever—there was definitely peer pressure to mold myself into something more quote-unquote ‘feminine,’” she says. That changed for her during a challenge whereby girls had to program a robot to find its way through a maze using visual processing. “When I finally solved it, it was just one sigh of relief, followed by bliss and joy I will never forget,” she says. “It was really cool to see that we use all these tools and techniques to design something practical.” Robinson is now a computer science major at Brandeis University, currently applying for jobs in the tech industry. “Now I use those skills to help other women in my class,” she says. “I tell them, you are so awesome, you just missed a semicolon.”

That emphasis on not only technical skills but also building girls’ confidence up to where they can solve problems is what sets Saujani’s vision apart from other programs, says DasGupta, who is now a board member of Girls Who Code. “We don’t just teach computational thinking, we teach the sisterhood,” she says, “helping girls with the soft skills of resilience and bravery.”

In addition to teaching them skills, the program opens doors to job opportunities. The organization is selective about what companies it works with to host sessions, requiring that along with space they provide access to employees who talk to the girls about what they do. Saujani’s hope is that girls will be better able to envision themselves as employees of tech companies one day, and can start developing ties to those who will help them network when applying for jobs in the future.

Graduates of the program have gone on to become computer science majors and to win hackathons. Two girls who created Tampon Run—a video game designed to take the shame out of menstruation that made the Apple app store and has been played more than 300,000 times—wrote a book about their experience, Girl Code: Gaming, Going Viral, and Getting It Done, which was published in 2017. Another graduate, who created an anti-cyberbullying app, appeared on the entrepreneur reality show Shark Tank and walked away with a $100,000 deal.

Reshma Saujani with students working on a computer.

“It’s not overstating it to say [Saujani] started a movement,” says DasGupta. “For the girls in the program, she is a mentor and a celebrity and the person they look up to.” When she started the program, in 2012, Saujani set out with the goal of training 1 million girls by 2020. While she now admits that goal was overly ambitious, the program has already had an impact, so far graduating 40,000 girls and ramping up to graduate 10,000 more each year. To expand her reach, Saujani put out her own book, Girls Who Code, this past August, and is launching book circles for girls to discuss it. Between those and the ongoing coding clubs, she hopes to reach more than 100,000 girls in 2018. “Last year, only 40,000 people in the country graduated in computer science,” she says, “and we’ve already taught 40,000 girls. This is a problem that is solvable.”

Even though she has veered away from politics, Saujani has arguably had more impact on education than she might have had from a strict policy perspective. “Her work appeals to people on so many levels,” says Goldbas. “There is a component of helping the underserved, of addressing poverty, and creating alignment with industry. After losing her last election, she could have gone back to being a lawyer or joined a think tank. The fact that she is using her platform in this way really speaks to her strategic mindset.”

Not that Saujani has completely lost her political spark. When Ivanka Trump used her as an example of women’s empowerment in her book Women Who Work, Saujani shot back on Twitter: “@ivankatrump don’t use my story in #WomenWhoWork unless you are going to stop being #complicit #askivanka”—referring to criticism of the president’s daughter that she has not served as enough of a check on her father’s policies.

In an op-ed in the New York Times last September, Saujani elaborated, saying she had rejected Ivanka Trump’s invitation to the White House after the president had signed an executive order refusing entry to immigrants from seven predominantly Muslim countries. The order made Saujani think of her own Muslim students, she wrote. “If I agreed to work with this administration, how could I look these girls in the eye? And what good would it do to advance my organization’s educational mission if I offered implicit support to an administration that didn’t see these girls and members of their families as fully American?”

Although the White House recently pledged $200 million to computer science education, Saujani believes that more good could be done for girls in STEM on the state level. She urges states to make computer science mandatory for all students—so that girls can grow up seeing coding as a natural subject for everyone, not just an elective for boys. “If they have this image it's just full of dudes, things are not going to change,” she says. Ultimately what is required for girls to fully embrace STEM, says Saujani, is a cultural shift. “Disney could do its next big movie on a girl coder, and this problem would be solved,” she says. Until that time, however, programs like Girls Who Code can provide girls with the push they need to discover their own potential—and find the courage to think of themselves differently in the world.

Michael Blanding is a freelance writer living in Brookline, Massachusetts.