Chaîne alphabétique [python]

Écrire une fonction qui permet de vérifier si une chaîne est alphabétique (y compris le caractère espace).

Def Verif(ch):
    i=0
    x=ord("A")
    y=ord("Z")
    esp=ord(" ")
    test=True
    while((test==True)and(i<len(ch))):
        z=ord(ch1[i])
        if(not( z in range(x,y+1)or(z==esp) )):
            test=False
        i+=1
    return test

Leave a Reply

Your email address will not be published. Required fields are marked *