+ 1

ON splitting lesson in python, I have the right output but with extras added.

On the splitting lesson in python I am told to create a program that outputs the last thing in a input list. x = input() elements = x.split() #ENTER CODE HERE x = elements[::-1] y = x[0:1] print(y) Problem is when I use the code its the right answer but apparently it's looking the answer without the [' '] surrounding it. Is there a way to remove it?

18th Nov 2020, 2:04 PM
Chris Reid Harvey
Chris Reid Harvey - avatar
3 odpowiedzi
0
If you don't mind me asking what's the difference between your code and mine. Mine is just the longer way to the answer correct? What part of my code adds the [' '] around the numbers?
18th Nov 2020, 2:12 PM
Chris Reid Harvey
Chris Reid Harvey - avatar
0
Thank you so much for your help.
18th Nov 2020, 2:18 PM
Chris Reid Harvey
Chris Reid Harvey - avatar