As of now, I think I've identified a piece of code that is causing an infinite loop. However, I cannot find out how to fix it. My theory: the first if statement is contradicting with the other if statements, causing an infinite loop. Please help, thanks.
Code:
x = 0
while (x != w):
word = ""
if (x != 0):
word = " "
if (second_alpha >= 25 and first_alpha >= 25 and switch_to_two_char):
first_alpha = 0
second_alpha = 0
switch_to_three_char = True
elif (first_alpha >= 25):
first_alpha = 0
switch_to_two_char = True
elif (second_alpha >= 25):
second_alpha = 0
first_alpha += 1
elif (third_alpha >= 25):
second_alpha += 1
third_alpha = 0
else:
if (switch_to_two_char and not switch_to_three_char):
second_alpha += 1
if (switch_to_three_char):
third_alpha += 1
else:
first_alpha += 1
Aucun commentaire:
Enregistrer un commentaire