Skip to main content

fixme1.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 20: unexpected indent.

┌──(kali㉿kali)-[~/Desktop]
└─$ python fixme1.py
File "/home/kali/Desktop/fixme1.py", line 20
print('That is correct! Here\'s your flag: ' + flag)
IndentationError: unexpected indent

Unlike languages such as C++ or JavaScript, which use curly braces to define code blocks, Python relies on indentation (tabs or spaces) to determine code structure and nesting. This means that incorrect or inconsistent indentation can lead to syntax errors.

Looking at line 20, we notice that the print statement is indented even though it's not inside any function, loop, or conditional block. To fix the error, we simply remove the unnecessary indentation.

flag = str_xor(flag_enc, 'enkidu')
print('That is correct! Here\'s your flag: ' + flag)

After correcting the indentation and rerunning the script, the program executes successfully - and reveals the flag.

┌──(kali㉿kali)-[~/Desktop]
└─$ python fixme1.py
That is correct! Here's your flag: picoCTF{1nd3nt1ty_cr1515_6a476c8f}

🚩Flag

picoCTF{1nd3nt1ty_cr1515_6a476c8f}