The promise of a new laptop -- that's what lured Mamadou Diallo into taking his first coding course.

That was three years ago -- and the new Windows computer and weekend workshop have helped Diallo's future look very, very bright.

Diallo, 17, hosts hackathons for teens, teaches other underprivileged kids how to code at the Knowledge House, and takes a full course load of AP classes. He's captured the attention of Stanford University, where he's been offered a full ride.

But the road to Stanford wasn't exactly paved for him.

Born in the Bronx, his family hails from Guinea. When Diallo -- who is one of nine kids -- was less than a year old, his cousin Amadou Diallo was shot 41 times and killed by police in the Bronx.

Fearing for their safety, Diallo's parents sent Diallo and two of his siblings back to Guinea to live with their extended family.

Diallo, whose first language is Pular, moved back to New York when he was 8.

When he was 14, Diallo discovered his first coding class while scrolling through Facebook. In exchange for spending a weekend at a Code Now workshop, he'd get a free laptop. "We learned Ruby, we made turtles move, super basic things," he said.

Related: From bullied teen to 17-year-old CEO

He emailed the New York Tech Meetup to ask about other coding opportunities for a high schooler like himself. Christina Halpern, an entrepreneur who was about to launch an organization called All Star Code, responded.

Halpern noticed that while many programs catered to young girls, there were few helping young boys of color.

"That really struck me as a huge problem because boys [of color] face really unique and significant challenges in America today," said Halpern.

Diallo was one of 20 students who participated in All Star Code's first summer program in 2014. The free program provides underprivileged kids with mentors and computer science training.

Diallo went on to cofound Young Hackers, an organization that gathers teen programmers for hackathons.

"Hanging out with kids has made me more confident, we're sitting around cracking jokes," he said. "I hang out with them every chance I get."

They've hosted seven events so far.

He was also accepted into LEDA, a nonprofit that helps disadvantaged students gain admittance to the country's top tier colleges and universities. The students spent the summer at Princeton University, free of cost, learning about diversity and leadership.

Diallo taught a workshop on web design to get others interested in tech.

"It's nice to have a niche," he said.

Related: 15-year-old steps down from babysitting startup because ... high school

No one in his family is involved in -- or quite understands -- the tech industry, he says. His father is a cab driver. His mother used to sell hats, handbags and T-shirts on the street in Harlem.

"It's a struggle to explain to my mother what I'm doing," Diallo said. "'Why are you using your laptop? Your eyes are going to burn,' she says. That's what she believes."

Diallo has "mentally and verbally committed" to Stanford, but is waiting for the admitted students' weekend in April to seal the deal.

Beyond that, Diallo wants to work at a social impact firm -- one like All Star Code, or perhaps one he starts himself.

When he was first introduced to All Star Code, he wasn't really aware of the lack of diversity in tech, he said. But after visiting many of the big tech firms, "you start to realize it." That's why giving kids like Diallo access to coding education early is so important.

It opened a window for Diallo that he says he didn't know existed. "Now, there's nothing stopping me except myself," Diallo added.