Write a programElementary20 XPExercise 2/9

Prime numbers

Task

The user enters whole numbers, each on its own line, and ends with -1. For every number the program immediately prints prvocislo (prime) or nie je prvocislo (not prime).

At the end it prints two lists: the primes entered on the first line and the other numbers on the second - in the order entered. Remember that 0, 1 and negative numbers are not primes. The numbers may be large (a million and more).

Examples

  • Input

    7
    8
    13
    -1

    Expected output

    prvocislo
    nie je prvocislo
    prvocislo
    [7, 13]
    [8]

After you submit, 5 hidden tests will also check your solution: 0, 1 and 2, a large prime, a product of two primes, no numbers, a negative number.

Python starts the first time you run code.

Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.

Input (stdin)

Each line = one call to input().

Output

Hints

Try it yourself first. Each hint reveals a little more - and lowers the reward a little.

Signed out, hints are free - but no XP is awarded either.

Solution

The solution unlocks after the last hint.