is CO2 a single atom or molecules?

It's a molecule. It consists of three atoms; i.e., 1 atom of C and 2 atoms of oxygen. A single atom would not have a formula of two elements attached to one another. For example, Na is a single atom. Na2O is a compound.

thanks:) so why is Rb2O a formula untis and not a molecule?

Rb2O is an ionic compound and that is the simplest empirical formula for the compound. However, in ionic compounds there is a three-dimensional array of positive and negative ions (Rb^+ and O^-2 ions in this case) so there is no molecule as such. We often call them molecules and we refer to molar mass and molecular weight which is why some profs prefer to call them formula weights or formula masses to indicate that is the mass of the formula and not a molecule. Technically, we should write NaxClx for NaCl because the 3-D array consists of x units of Na^+ and x units of Cl^- and they stretch in three dimensions. The value of x is some number that depends upon how large the formula unit we are viewing happens to be. x is one value for a cube of NaCl 1 cm x 1 cm x 1 cm but some other value for a cube of NaCl that is 1.5 cm x 1.5 cm x 1.5 cm.

CO2 is a molecule, not a single atom. It consists of three atoms: one carbon atom (C) and two oxygen atoms (O). To determine whether a substance is a single atom or a molecule, we need to look at its chemical formula. In the case of CO2, the presence of a subscript "2" after the O indicates that there are two oxygen atoms bonded together with a carbon atom, forming a molecule of carbon dioxide.