@reagentx/

Proof Read

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def proofread(string):
    out_s = ''
    prev = ''
    ei = False
    for i, letter in enumerate(string):
        print(i, letter, prev, out_s)
        if i == 0:
            out_s += letter.upper()
            continue
        elif i == len(string) - 1:
            out_s += prev + letter.lower()
        else:
            if letter.lower() == 'e' and prev == 'i':
                out_s += 'ei'
                ei = True
            elif ei:
                ei = False
                pass
            else:
                out_s += prev
        prev = letter.lower()
    return out_s
        
        
print(proofread("SHe wEnt CaNoIenG."))