To add a new value to a set like answers
, code add()
, with the new value , like "maybe" between the parentheses.
Note that elements in sets are unordered. Hence, we can't be sure in which order the items will appear when printed.
>>> answers = {"yes","no"}
>>> answers.add("maybe")
>>> answers
{'yes', 'maybe', 'no'}