0

Why it doesn't work?

n = input().split(" ") # n = ['2', '3', '4'] print(n.index(2))

28th Jul 2018, 7:39 AM
Tincture
3 Answers
+ 5
use "n = [int(i) for i in input().split()]" or "print(n.index('2')"
28th Jul 2018, 8:02 AM
Mert Yazıcı
Mert Yazıcı - avatar
0
n = list(input())#splits the input into a list containing each character print(n[1]) #prints out the char #[0] for 1st char #[1] for 2nd char try this
28th Jul 2018, 7:59 AM
Timothy Joseph
Timothy Joseph - avatar
0
The list elements are strings print(n.index( '2' ) will work
28th Aug 2018, 3:49 AM
Aravind Shetty
Aravind Shetty - avatar