0

Why do i get index is out of range if it is in a separate if statement and how do i fix this? For example when it says if len(c)

print ('What do you want to do?') a = input ('1. Take notes 2. Summarize notes: ') if a == ('1'): b = input ('Paste article or reading: ') c = b.split('.') def notes(c): if len(c) < 3: d = ''.join(c[1]) ac = d.lstrip(' The') print('- ' + ac) elif len(c) == 4 or 3: d = ''.join(c[1]) e = ''.join(c[3]) print('- ' + d) print('- ' + e) elif len(c) == 6 or 5: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) elif len(c) == 8 or 7: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) elif len(c) == 10 or 9: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) h = ''.join(c[9]) elif len(c) == 12 or 11: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) h = ''.join(c[9]) i = ''.join(c[11]) elif len(c) == 14 or 13: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) h = ''.join(c[9]) i = ''.join(c[11]) j = ''.join(c[13]) elif len(c) == 16 or 15: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) h = ''.join(c[9]) i = ''.join(c[11]) j = ''.join(c[13]) k = ''.join(c[15]) elif len(c) == 18 or 17: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) h = ''.join(c[9]) i = ''.join(c[11]) j = ''.join(c[13]) k = ''.join(c[15]) l = ''.join(c[17]) elif len(c) == 20 or 19: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) h = ''.join(c[9]) i = ''.join(c[11]) j = ''.join(c[13]) k = ''.join(c[15]) l = ''.join(c[17]) m = ''.join(c[19]) elif len(c) == 22 or 21: d = ''.join(c[1]) e = ''.join(c[3]) f = ''.join(c[5]) g = ''.join(c[7]) h = ''.join(c[9]) i = ''.join(c[11]) j = ''.join(c[13]) k = ''.join(c[15]) l = ''.j

17th Oct 2018, 5:30 AM
NicoChis
NicoChis - avatar
1 Réponse
+ 1
Again, you can't use "if x == y or z" to check if x == y or x == z. Just look at the explanation you got last time. Post a link to your full code so that others can understand what you're trying to do
17th Oct 2018, 5:58 AM
Anna
Anna - avatar