samedi 6 juin 2020

Python else block doesn't print anything

Here in this code else block is not printing the value Treasure locked

def counted(value):
    if(value == 5):
        return 1
    else:
        return 0

def numb(value1):
    sam = 95
    value = 0
    stp = 97
    h = {}
    for i in range(0,26):
        h.update({chr(stp) : (ord(chr(stp))-sam)})
        sam = sam-1
        stp = stp+1
    for j in range(0,5):
        value = h[value1[j]]+value

    if(value > 80):
        print('First lock-unlocked')
    else:
        print('Treasure locked')

string = input()
firstcheck = counted(len(string))
if(firstcheck == 1):
    numb(string)

Aucun commentaire:

Enregistrer un commentaire