Verification code

Report a typo

You're building a sign-up page that emails users a code to verify their address. Your job is to generate that code.

Write a function that returns a verification code: a random string of length 10 built by randomly picking characters from the letters string below (repeats are allowed).

Note: Random is already available in this file, so you don't need to add an import statement.

Write a program in Kotlin
fun verificationCode(): String {
// use these letters to create the code
val letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"

// complete the function and then return the code
}

Create a free account to access the full topic