Need some pytho help | Sololearn: Learn to code for FREE!

0

Need some pytho help

X = "banana" i want print 2nd letter and 4th letter in oder .how is it do ?

10/24/2019 5:06:40 PM

Chanaka

3 Answers

New Answer

+5

print(X[1], X[3])

+1

s = "banana" for i,x in enumerate(s,1): if i%2 == 0: print(x, end='') # output: aaa