Harry Potter is learning different spells. He has a list of spells and their power values. He must retrieve the first spell with the power greater than 50. Please help Harry find the spell or print "No spell found" if it doesn't exist.
Retrieve single element
Harry and the Spell Power
Report a typo
Sample Input 1:
Expetum-98 Patronus-83 Axio-29 Lithigum-23Sample Output 1:
Spell(name=Expetum, power=98)Write a program in Kotlin
data class Spell(val name: String, val power: Int)
fun main() {
val input = readln().split(" ")
val spells = input.map { Spell(it.split("-")[0], it.split("-")[1].toInt()) }
// write your code here
}
___
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.