4.1 Count dots on 5 black and white cards (without a loop)

Scratch solution

View solution

This is just one of many possible solutions:

whenclickedsettotal number of dotsto0askWhat's your first card (B for black, W for white)?andwaitifanswer=Wthensettotal number of dotstototalnumberofdots+16askWhat's your second card (B for black, W for white)?andwaitifanswer=Wthensettotal number of dotstototalnumberofdots+8askWhat's your third card (B for black, W for white)?andwaitifanswer=Wthensettotal number of dotstototalnumberofdots+4askWhat's your fourth card (B for black, W for white)?andwaitifanswer=Wthensettotal number of dotstototalnumberofdots+2askWhat's your fifth card (B for black, W for white)?andwaitifanswer=Wthensettotal number of dotstototalnumberofdots+1saytotalnumberofdots

Back to programming challenge