We develop a robust coarse-grained model for single- and double-stranded DNA by representing each nucleotide by three interaction sites (TIS) located at the centers of mass of sugar, phosphate, and base. The resulting TIS model includes base-stacking, hydrogen bond, and electrostatic interactions as well as bond-stretching and bond angle potentials that account for the polymeric nature of DNA. The choices of force constants for stretching and the bending potentials were guided by a Boltzmann inversion procedure using a large representative set of DNA structures extracted from the Protein Data Bank. Some of the parameters in the stacking interactions were calculated using a learning procedure, which ensured that the experimentally measured melting temperatures of dimers are faithfully reproduced. Without any further adjustments, the calculations based on the TIS model reproduce the experimentally measured salt and sequence-dependence of the size of single-stranded DNA (ssDNA), as well as the persistence lengths of poly(dA) and poly(dT) chains. Interestingly, upon application of mechanical force, the extension of poly(dA) exhibits a plateau, which we trace to the formation of stacked helical domains. In contrast, the force-extension curve (FEC) of poly(dT) is entropic in origin and could be described by a standard polymer model. We also show that the persistence length of double-stranded DNA, formed from two complementary ssDNAs, is consistent with the prediction based on the worm-like chain. The persistence length, which decreases with increasing salt concentration, is in accord with the Odijk-Skolnick-Fixman theory intended for stiff polyelectrolyte chains near the rod limit. Our model predicts the melting temperatures of DNA hairpins with excellent accuracy, and we are able to recover the experimentally known sequence-specific trends. The range of applications, which did not require adjusting any parameter after the initial construction based solely on PDB structures and melting profiles of dimers, attests to the transferability and robustness of the TIS model for ssDNA and dsDNA.