I need to remove first and last character from list and return number. Where I did go…
Private research annotation
Sign in to add a private research label or note.
Jump to turn (6)
- 1I need to remove first and last character from list and return number. Where I d
- 2I have to insert spaces between numbers in my string. Like "2 3 4", not just "23
- 3Sorry, my fault. I forgot to make a space in return ' '.join().
- 4How does this solution work? def array(strng): return ' '.join(strng.split(',')[
- 5How to make the same task in Javascript? Can you give some tips, not code
- 6How do you like this? function array(string) { let items = string.split(','); le
- User
I need to remove first and last character from list and return number. Where I did go wrong? Examples: "1,2,3" => "2" "1,2,3,4" => "2 3" "1,2,3,4,5" => "2 3 4"
"" => NULL "1" => NULL "1,2" => NULL
My code: def array(string):
codeif len(string) < 3: return None result = str([i for i in string if i != string[0] and i != string[-1]]) return result - Assistant