Powers on new lines

You are given the list of powers of 2 which includes all the powers of two that have 1-4 digits.
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
For easier visualization, you’re asked to group the powers of 2 by the number of digits.
The program should first print These are the powers of two: after which, the second line should contain all the single-digit powers of two (1, 2, 4, 8). The next line should contain powers that have double-digits. Then comes a line with 3 digits and finally all the 4-digit numbers.
The numbers on each line should be separated by a space and a comma. Each line of numbers should start with an opening bracket ( and end with a closing one ).
 
To check your solution you need to sign in
Sign in to continue