Without seeing your relevant code fragments we can't help with your syntax error at all - look at the line that the system is reporting a problem with and find which symbol is "odd".
Or post the actual code and we'll see if we can help.
But to answer the question "how to write a program that delete random image from folder in python code"...
1) Read a list of all the files in the folder:
os.listdir — Python documentation[
^] will do that.
2) Generate a random number between 0 and the number of files:
random — Generate pseudo-random numbers — Python documentation[
^]
3) Delete the file at that index:
os.remove — Python documentation[
^]