Bug description:
I continue to get the “list assignment index out of range” error when after comparing to another program I’ve made, there’s no major differences that would cause this issue. All the other variables are already defined.
Expected vs Current Behavior:
The for loop should change every value of the string list to either a symbol, number, uppercase character, or lowercase character. But throws an error saying that the index used doesn’t exist.
string = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "12", "13", "14", "15"]
for i in range(15):
character_types = (1, 2, 3, 4)
character_type = random.choice(character_types)
if character_type == 1:
string[i] = random.choice(lowercase_character_list)
elif character_type == 2:
string[i] = random.choice(uppercase_character_list)
elif character_type == 3:
string[i] = random.choice(number_list)
else:
string[i] = random.choice(symbol_list)
I have used this method at replit.com/@randomcat962/Practice-Typing-in-English#main.py and there was no issue.
Steps to reproduce:
Run the program and run the other program. See how one works and the other doesn’t?
I’m sorry if this is code error!
Bug appears at this link: https://replit.com/@randomcat962/Random-Passoword-Generator#main.py
Screenshot(s)/Screen Recording:
Browser/OS/Device: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Replit/1.0.0 Chrome/116.0.5845.97 Electron/26.1.0 Safari/537.36 ReplitDesktop
Replit Profile: https://replit.com/@randomcat962