How to detect if the typed string has more than 6 characters?

Asked

Viewed 101 times

-1

How do I detect that the string typed by the user has more than 6 characters for example???

. . . . . ..

.

  • 1

    Where was this typed Mark? You can put the code that requests this information?

2 answers

2


just use Len(string)>6, the function Len te returns the size of the string ai just compare with the number you want

2

You can do thus:

senha = '123Mudar'   # variável com a senha
tamanho = len(senha) # calcular o tamanho da senha com a função len
if tamanho > 6:      # verificar se a senha é maior que 6
  print("Senha maior que 6")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.