File size: 537 Bytes
7337ffe
d57024f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def generate_fix(code):
    lines = code.split("\n")
    fixed_lines = []
    for line in lines:
        line = line.strip()
        if line.startswith("print ") and not line.startswith("print("):
            content = line[6:].strip()
            fixed_lines.append(f"print({content})")
        else:
            fixed_lines.append(line)
    return "\n".join(fixed_lines)
# Optional test
if __name__ == "__main__":
    buggy = "a = input()\nprint a"
    print(generate_fix(buggy))



#genrate the fixed version of code using an ML Model