Start learning free

LESSON 168 OF 404 · PROJECTS: EVERYDAY PROGRAMS

Password Strength V1 - Length Check in Go

Practice

Check a password's length and print whether it is long enough.

You start with:

password := "Secret99"

Build:

Password length: 8
OK

Rules:

  • Print "Password length: " followed by the number of characters.
  • If the length is at least 8, print OK; otherwise print Too short.
  • Use strconv.Itoa(n) to turn a number into text before joining it to a string.

Try other passwords: with abc the output is

Password length: 3
Too short
STEP 1 OF 4
    Ctrl + Enter to check

    Password Strength V1 in Go

    Keep going with GoAbout 340 step-by-step lessons, from your first line of code to coding interviews. Free to start.
    Start learning free