Cod sursa(job #2528377)

Utilizator arosearose red arose Data 21 ianuarie 2020 20:07:34
Problema Text Scor 40
Compilator py Status done
Runda Arhiva de probleme Marime 0.6 kb
import string


if __name__ == '__main__':
    total = 0
    nrLitere = 0
    with open('text.in','r') as fh:
        line = fh.readline()
        newWord = False
        for c in line:
            if c not in string.ascii_letters:
                if newWord==True:
                    total += 1
                    newWord = False
            else:
                nrLitere += 1
                if newWord == False:
                    newWord = True

        if newWord == True:
            total += 1

        print(nrLitere)
        print(total)

        open('text.out','w').write("%d"%(nrLitere//total))