print(list(i for i in range(2,50) if not any(i%j == 0 for j in range(2,i))))
Standard input is empty
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!