Having troubles with the shell print weird things

Problem Description:
when I run it the program keyword variable is “stop” when it was set to “”

Bug appears at this link:



Youir question… is really confusing? Try this? Idk what you want tho

keyword = ""
character = ""
filelines = []
f = open('main.simple', 'r')
filelines = f.readlines()
for i in range(len(filelines)):
    line = filelines[i].strip()
    if keyword == "stop":
        raise ValueError("keyword variable is not cleared")
    for i in range(len(line)):
        character = line[i]
        keyword = keyword + character
        if keyword == "stop":
          keyword = ""
1 Like

thank you so much it works perfectly, but I was wondering what I did wrong

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.