Python index question?

Given a string of any length named s, extract and then print the first and last characters of the string (with one space between them).

For example, given

s = 'abcdef'

The output will be 'a f'

1 Answer

Relevance
  • EddieJ
    Lv 7
    7 months ago
    Favorite Answer

    x = s [0] + " " + s [-1]

Still have questions? Get your answers by asking now.