Using grand canonical Monte Carlo simulations of a flexible polyelectrolyte where the charges are in contact with a reservoir of constant chemical potential given by the solution pH, we study the behavior of weak polyelectrolytes in poor and good solvent conditions for polymer backbone. We address the titration behavior and conformational properties of a flexible diblock polyampholyte chain formed of two oppositely charged weak polyelectrolyte blocks, each containing equal number of identical monomers. The change of solution pH induces charge asymmetry in a diblock polyampholyte. For diblock polyampholyte chains in poor solvents, we demonstrate that a discontinuous transition between extended (tadpole) and collapsed (globular) conformational states is attainable by varying the solution pH. The double-minima structure in the probability distribution of the free energy provides direct evidence for the first-order like nature of this transition. At the isoelectric point electrostatically driven coil-globule transition of diblock polyampholytes in good solvents is found to consist of different regimes identified with increasing electrostatic interaction strength. At pH values above or below the isoelectric point diblock chains are found to have polyelectrolyte-like behavior due to repulsion between uncompensated charges along the chain.