How to detect if the string entered is longer than 6 characters? [closed]

-1
  

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

. . . . . ..

.

    
asked by anonymous 22.06.2018 / 21:50

2 answers

2

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

    
22.06.2018 / 21:53
2

You can do like :

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")
    
22.06.2018 / 21:55