Yet there she was on Friday morning at Portland Public Library, turning her mortarboard tassel and marching to “Pomp and Circumstance” along with about a dozen other Portland area teenagers and young adults, many of whom long believed such a ceremony would never include them.

The otherwise traditional graduation exercise was held for 15 students who passed their GED tests after taking part in the Second Chance Youth Building Alternatives program administered by the Portland nonprofit LearningWorks.

Students in the program are high school dropouts — in this particular class, between the ages of 17 and 24. The program serves about 100 students over the course of each year, many of whom have battled substance abuse or have been in trouble with the law, and about 40 percent of whom are homeless, said LearningWorks Executive Director Ethan Strimling.

On hand to congratulate the new graduates and distribute certificates Friday was Gov. Paul LePage, who is known for having faced similar circumstances as a youth. LePage left home to escape his abusive father at the age of 11 and lived on the streets for a period while working his way through school.

“Very few people have walked in your shoes,” LePage told the graduates on stage Friday. “It’s an enormous challenge when you’re living on the streets and have taken the wrong paths at the ‘Y’ in the road. Once you’re lost, you’re lost, and the only way to get back on track is to fight for it yourself.”

DiPietro said she was a different person last May when she reluctantly entered Youth Building Alternatives, which combines classroom work with specialized trade programs such as carpentry or culinary arts.

Students in YBA tackle off-campus projects like rehabilitation of apartments for the Portland Housing Authority; do community service at places like the Wayside Food Pantry and Camp Ketcha; take field trips to sites such as Wolfe’s Neck Farm in Freeport; and engage in leadership and team-building exercises.

Youth Building Alternatives has been in place in Portland since 1994, and LearningWorks is planning to launch a similar program in Biddeford next year, Strimling said.

“I came from an abusive home, and really had a lot of drama in school,” DiPietro said Friday. “So I partied, made bad decisions and was put on probation.”

Seven months after entering the program, DiPietro said her life has changed “100 percent.” She described herself as “more mature, more tolerant,” and is interested in careers in construction or education.

“It’s a new life,” agreed Christopher Rubera, another of Friday’s graduates.

Rubera stopped short of giving specifics about what drove him to drop out of school and how he ended up in the Youth Building Alternatives program, but said without the change, his life “wasn’t going to end well.”

Rianna Tuttle said when she arrived at YBA she “didn’t want to be there and had a negative attitude,” but said the program faculty and staff were persistent with her, calling and emailing tirelessly on the days she didn’t show up early on.

“I’ve made some poor choices in my life, but I’ve learned from those choices,” she said.

While many Maine teenagers take for granted they will graduate from high school — the state’s graduation rate is among the highest in the country at greater than 80 percent — many of Friday’s celebrants had previously viewed the milestone as inconceivable, Strimling said.

“These kids are smart, but their life circumstances were such that [they] blocked them from going places a lot of kids go,” he said.

“Some [of Friday’s program graduates] left school in the eighth grade, and some had taken three or four GEDs before coming to us,” YBA Director Soni Waterman said during the ceremony.

Waterman became emotional while reading an essay submitted by one of Friday’s graduates, who she said preferred to remain anonymous. The student wrote about “escaping past wrongs.”

“Sometimes the wrong choices bring us to the right places,” Waterman read, “and I think the last couple of years have shown that.”