We study the quantized topological terms in a weak-coupling gauge theory with gauge group Gg and a global symmetry Gs in d space-time dimensions. We show that the quantized topological terms are classified by a pair (G, ν d ), where G is an extension of Gs by Gg and ν d an element in group cohomology H d (G, R/Z). When d = 3 and/or when Gg is finite, the weak-coupling gauge theories with quantized topological terms describe gapped symmetry enriched topological (SET) phases (ie gapped long-range entangled phases with symmetry). Thus, those SET phases are classified bywhere G/Gg = Gs. We also apply our theory to a simple case Gs = Gg = Z2, which leads to 12 different SET phases in 2+1D, where quasiparticles have different patterns of fractional Gs = Z2 quantum numbers and fractional statistics. If the weak-coupling gauge theories are gapless, then the different quantized topological terms may describe different gapless phases of the gauge theories with a symmetry Gs, which may lead to different fractionalizations of Gs quantum numbers and different fractional statistics (if in 2+1D).