0

Python lists

what does "-" do if you put it before an index number such as: bruh = ["Hello", "world"] print(bruh[-0]) i am pretty sure it returns "world" but not quite, tell me if i'm right or wrong please

3rd Nov 2020, 12:16 PM
Mad
Mad - avatar
2 Réponses
+ 4
negative zero is still zero, so the first element is printed.
3rd Nov 2020, 12:18 PM
Gordon
Gordon - avatar
+ 2
Mad why don't you open the code playground and try it yourself?
3rd Nov 2020, 12:28 PM
Yurii Ostapenko
Yurii Ostapenko - avatar