1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How can I add some form of verification to block users from inputting numbers or...

Discussão em 'Python' iniciado por Stack, Setembro 23, 2024.

  1. Stack

    Stack Membro Participativo

    It is for a college project. I have got the main part of it done, but I want to add some sort of verification of what will be my teachers' input, I know he will try putting in random numbers and spamming a single letter. I have got number blocking to work with while loops but don't know where to go from here to also include blocking a string shorter than three letters without my code getting messy.

    I have tried defining a variable but didn't really know how to do it. Would something like this work?

    if variable.isdigit() or len(variable) <= 3 == True:
    print("That's not a valid input!")
    print(f"{name}, what is your favourite animal?

    Continue reading...

Compartilhe esta Página