Start free

Beginner · Strings · 98 of 264

Strong password

A password is strong when it has at least 8 characters, at least one digit and at least one capital letter.

Input: one line, the password. Output: strong or weak

Examples

Input
Secret123
Output
strong
Input
secret123
Output
weak
Input
SECRETPASS
Output
weak

2 more tests check other inputs when you press Check.

Stuck? The idea behind strings

A string is text. len() counts its characters; word[0] is the first, word[-1] the last; word[1:4] is a slice, from position 1 up to (not including) 4.

Methods give a new string and leave the old one as it was: .upper(), .lower(), .strip(), .replace(old, new), .split().

word = input()
print(len(word))
print(word.upper())
print(word[::-1])  # backwards

Watch for: word.upper() on its own line changes nothing: keep the result (word = word.upper()) or print it.

All the strings exercises
Your code
Opening the code editor…
Python 3.14 in your browser
Output
Run shows what your program prints. Check tests it on every example and the hidden tests.

More strings exercises