+ 1

How to remove brackets and apostrophes

x = input() elements = x.split() print(elements[-1::1]) The output is correct but it won't accept it because it has to have no brackets and apostrophes and all the past lessons regarding splitting have brackets

1st Sep 2020, 12:32 PM
Shuarma
Shuarma - avatar
4 Answers
+ 2
thank you againnnnn
1st Sep 2020, 12:39 PM
Shuarma
Shuarma - avatar
+ 1
fyi if you want to slice w/o brackets use print(elements.__getitem__(4)) but i may have misunderstood your question :/
1st Sep 2020, 12:43 PM
madeline
madeline - avatar
+ 1
1.elements=x.split(" ") 2.print(elements[:-1][0] 3.el=[] for i in elements: el+=i print(el[:-1])
1st Sep 2020, 1:29 PM
Shadoff
Shadoff - avatar