fixme2.py
- Description: Fix the syntax error in this Python script to print the flag.
- Difficulty: Easy
🔎 Solution
This challenge focuses on debugging a Python script. When running the program, it immediately throws an error at line 22: invalid syntax.
┌──(kali㉿kali)-[~/Desktop]
└─$ python fixme2.py
File "/home/kali/Desktop/fixme2.py", line 22
if flag = "":
^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
In Python, conditional statements like if require the comparison operator ==
to test equality.
The error at line 22 occurs because a single =
is mistakenly used instead of ==
.
if flag == "":
print('String XOR encountered a problem, quitting.')
else:
print('That is correct! Here\'s your flag: ' + flag)
Fixing this syntax mistake and rerunning the script reveals the flag.
┌──(kali㉿kali)-[~/Desktop]
└─$ python fixme2.py
That is correct! Here's your flag: picoCTF{3qu4l1ty_n0t_4551gnm3nt_4863e11b}
🚩Flag
picoCTF{3qu4l1ty_n0t_4551gnm3nt_4863e11b}