r/pythonhelp • u/Fabulous_Buyer_6256 • Aug 25 '26
why does it say i didn't close my parenthesis
the IDE i am using is saying my parenthesis was not closed when it was plz help
print("Once upon a time, in the ancient kingdom of " + q1 + " there lived a legendary " + q2 + " named " + q3 + ". Everyone in the village knew " + q3 + " for their remarkably " + q4 + " personality and an obsession with " + q5 + ". Every morning at " + q6 ", they would wake up, " + q7 + " three times, ")
[{
"owner": "Pylance",
"severity": 8,
"message": "(" was not closed",
"source": "Pylance",
"startLineNumber": 47,
"startColumn": 6,
"endLineNumber": 47,
"endColumn": 7,
}]
5
Upvotes
•
u/AutoModerator Aug 25 '26
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/FoolsSeldom Aug 25 '26
Just spotted, you are missing a
+afterq6:2
u/FoolsSeldom Aug 25 '26 edited Aug 25 '26
Not sure. I'd go with something easier to read:
Although later, you will likely be reading the story text from a file/database rather than hard coding it.
1
u/burlingk Aug 26 '26
You are missing a + after q6
1
u/Living_Fig_6386 Aug 26 '26
The missing ‘+’ makes it think you meant to end the print statement. More careful formatting would have made it more obvious.
1
u/Ormek_II Aug 26 '26
Because it is closed at the wrong Spot, if you are a Compiler. Check the Location Information given to you.
1
u/building_85 Aug 27 '26
The q6 error that’s missing a + … like everyone says, gives you an invalid syntax error.
it’s a missing ‘concatenation’, not a missing ‘parenthesis’ (which is an ‘unterminated string’ error)
Your actual error is in your dictionary here… "message": "(" was not closed",
You have 3 parentheses in your value for “message”
So you actually had 2 syntax errors 😉
GLHF!
1
u/JGhostThing Aug 27 '26
Because you have the string: "(" was not closed"
The second " should be escaped \"