0
What is wrong with this code? đ
I know that this error appears if we put commas between keys and values in dictionaries so it becomes a set. But I donât see any commas, so I think I did I correct, but I still see this error. https://code.sololearn.com/cqacc6Eg1AIL/?ref=app
7 Respostas
+ 3
Here, I tried to fix it for you, again, I do not speak the language but that should be enough to keep you going :)
https://code.sololearn.com/cQgEwLm33bP1/?ref=app
+ 4
It says there is an issue in this line.
for q, a in questions.items():
Maybe it doesn't like the q, a part?
+ 3
I think you misused the multiline string
When making your question dictionary, try to avoid using """. If you need a new line in the question, consider using the new line character '\n' instead.
questions = {
'question': 'answer',
'2+2': '4',
'multi \n line \n question': 'cool',
}
I don't speak this language so forgive me if I misunderstood, but I hope this helps :)
+ 2
Oh that really works! Thanks you so much!
+ 1
The problem is that the first string opens and the last one closes with """, while all other openings and closings use ".
So, the "s don't close the strings - only the last """ does. And the whole contents inside the curly brackets become a single string.
Independent values inside curly brackets make a set, not a dictionary. That's why it errors when you try to iterate as a dictionary.
Solution: use consistent quoting for each string.
0
Ok Iâll try to use \n maybe it will work)
0
No I tried \n and it still shows an error đ€·đŒââïž StrangeâŠ(((