How to print the N letter of every word in a string in Python

1 Answer

0 votes
s = "Python is-an interpreted general purpose programming language"
 
N = 2

for word in s.split():
    print(word[N])

 
 
 
     
'''
run:
     
t
-
t
n
r
o
n
 
'''

 



answered Nov 2, 2021 by avibootz
...