// code challenge
Users from /etc/passwd
~12 min
Parse the classic colon-delimited file and extract real users.
`/etc/passwd` has one account per line, colon-delimited; field 1 is the username, field 3 the numeric UID:
``` root:x:0:0:root:/root:/bin/bash student:x:1000:1000::/home/student:/bin/bash daemon:x:1:1::/usr/sbin:/usr/sbin/nologin ```
Human accounts have **UID ≥ 1000**. Read: first line = integer N, then N passwd lines. Print the username of every human account (UID ≥ 1000), one per line, in input order.
For the sample above (N=3) the output is: ``` student ``` Hint: `parts = line.split(":")`, username = `parts[0]`, uid = `int(parts[2])`.
Language: python · Judge0
// sample tests
stdin"3\nroot:x:0:0:root:/root:/bin/bash\nstudent:x:1000:1000::/home/student:/bin/bash\ndaemon:x:1:1::/usr/sbin:/usr/sbin/nologin" →stdout"student"stdin"2\nalice:x:1000:1000::/home/alice:/bin/bash\nbob:x:1001:1001::/home/bob:/bin/zsh" →stdout"alice\nbob"
Sign in to run and submit.