0

How do I slice this

'Python is an interesting and useful language for numerical computing!' 

to get

'Pto sa neetn n sfllnug o ueia optn!? 

in Python?

ggorlen
  • 44,755
  • 7
  • 76
  • 106
  • 1
    Welcome to SO! By what operation are you achieving the result? Every other char? What code have you tried and where are you stuck? – ggorlen Nov 27 '18 at 02:28
  • x = 'Python is an interesting and useful language for numerical computing!' – user10709107 Nov 27 '18 at 02:36
  • I can do what is in the code below but not sure how to accomplish the goal above. x = 'Python is an interesting and useful language for numerical computing!' x[0:7] ##to get word Python Out[135]: 'Python ' x[68:] ##to get the exclamation Out[136]: '!' – user10709107 Nov 27 '18 at 03:04

1 Answers1

0

List indexing magic (rather no magic)

data = 'Python is an interesting and useful language for numerical computing!'
print(data)
print(data[0::2])
Krishna
  • 924
  • 1
  • 7
  • 28