• + 0 comments

    Kotlin is also really nice and clean. Especially like how clean the syntax for populating the initial array is. It has a little bit more boilerplate than Python, but still super pleasant compared to what you'd have to do in java 7 or lower.

    import java.util.Scanner
    
    fun main(args: Array<String>) {
        val sc = Scanner(System.`in`)
    
        val size = sc.nextInt()
        val inputs = Array(size, { sc.nextDouble() })
    
        println(inputs.count { it > 0.0} / size.toDouble())
        println(inputs.count { it < 0.0} / size.toDouble())
        println(inputs.count { it == 0.0} / size.toDouble())
    }