[https://pastebin.com/92iYPKAD](https://pastebin.com/92iYPKAD) (because reddit code formatting is stupid)
Quick explanation- while True constantly iterates and adds inputs to the set (if that's what you're looking for, its replaceable with lists too), and the continue acts as an if else. Upon receiving 0 it returns the set. The function also has a parameter that takes in the name of the set if you ever need it for your project.
Edit: the user\_input\[-1\] is redundant, user\_input alone is fine.
Haha no prob! Also a quick heads up if you're looking to add the whole string use set.add(). I don't usually work with sets and I completely forgot that set.update() takes each individual element of a string...
Use the Try block ( Error and exception)
[https://pastebin.com/92iYPKAD](https://pastebin.com/92iYPKAD) (because reddit code formatting is stupid) Quick explanation- while True constantly iterates and adds inputs to the set (if that's what you're looking for, its replaceable with lists too), and the continue acts as an if else. Upon receiving 0 it returns the set. The function also has a parameter that takes in the name of the set if you ever need it for your project. Edit: the user\_input\[-1\] is redundant, user\_input alone is fine.
Sweet. Thanks man! I might shoot you a DM if I have another question later on.
Haha no prob! Also a quick heads up if you're looking to add the whole string use set.add(). I don't usually work with sets and I completely forgot that set.update() takes each individual element of a string...