Is it possible do the following initializations in one line? As I am quite curious whether a shorter code is possible.
X = []
Y = []
You can initialize them using sequence unpacking (tuple unpacking in this case)
X, Y = [], []
because it's equivalent to
(X, Y) = ([], [])
You can also use a semicolon to join lines in your example:
X = []; Y = []
You can use tuple unpacking (or multiple assignment):
X, Y = [], []
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With