"While" can be used for contrasts. It can be used at the beginning, or in the middle of a sentence. "While" may be used in writing, but we usually use "but" when we speak.
Basic computers are cheap while custom-built computers are expensive.
or
While basic computers are cheap, custom-built computers are expensive.
or
Basic computers are cheap, but custom-built computers are expensive.
We would not use "but" at the beginning of a written sentence, but you may use it to start a sentence when speaking.
When comparing things that are the same, we use "both".
Example:
Both a laptop and a tablet have an internal battery.
Decide if the sentences are correct or incorrect:
1) While a keyboard is used for input, a screen is used for output.
2) A laptop has an internal battery, but a desktop doesn’t.
3) Both copper and plastic are conductors.
4) Both copper and steel are metals.
5) A window is made of glass but a light bulb isn’t.
6) Both glass and metal are transparent.
7) Both wood and steel are rigid.