Scally wants to output a set of numeric data in a fancy way by printing it with bars made of hash # symbols. In this format, 5 will be printed as #####. She started the program: can you finish it?
Note that we can print non-negative numbers only.
Modifying collections
Plotter
Report a typo
Sample Input 1:
-1 1 2 3 5Sample Output 1:
#
##
###
#####Write a program in Scala 3
object Plotter extends App {
def buildLine(length: Int, line: String): String =
if (length == 0) ??? else ???
val input = scala.io.StdIn.readLine()
val digits: List[Int] = input.split(' ').map(s => s.toInt).filter(???)
val output: List[String] = digits.map { ??? }
println(output.mkString("\n"))
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.