How does the interpreter identifies that a particular part of code is a set or dictionary, by the syntax inside the curly braces? Because both of them have curly braces I see
Differentiate between sets and dictionaries
Hey @Kunnaal, its very simple, if there exists ‘:’(colon) separated values with ‘,’ in between them, than it will be interpreted as dictionary, otherwise when there exists only ‘,’ separated independent values which are not ‘:’ separated it is interpreted as sets.
Hope this cleared your doubt.
Happy Learning
Okay sir if that’s the case, but when the brackets are empty { } then why is it considered as dictionary? I saw it in one of the video lectures that the type was dictionary
Hey @Kunnaal, yes when there are no elements in the braces, than it would be treated as dictionary. You can’t use set functions on that directly. So incase if you want to make empty set, use s = set({})
Hope this cleared your doubt.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
https://online.codingblocks.com/feedback/d/18650?_ga=2.59355114.652320254.1584356522-24817104.1582817359
this link that you just sent isn’t working
Webpage not avilable it shows
Hey @Kunnaal, that’s probably due to some issue at the backend. Nvm, thank you, at least you made an effort to give feedback for our work. Its highly appreciable.