You can have it generate shitty code and then compare it against examples it finds online to iterate that code. Also, it was trained on the whole internet, including those good solutions, and can often reproduce them on its own. but you have to tell it, explicitly, to do all this to make better code, rather than just asking for the code.
His tweet says it was his campaign and personal email, both of which are separate accounts from his house.gov email. But he probably uses his personal email for work