indeks tuple dalam python
# Creating a tuple using ()
t = (1, 2, 4, 5, 4, 1, 2,1 ,1)
print(t.index(5))
Coding boy Hasya
# Creating a tuple using ()
t = (1, 2, 4, 5, 4, 1, 2,1 ,1)
print(t.index(5))
#Read in the input using input()
user_input = ()
#Use the .count()
first_word = user_input[0]
print(first_word)
#Find how many times first_word exists in the remainder of the str
remainder = user_input[1:]
print('{} exists in {} {} times.'.format(first_word, remainder, remainder.count(first_word)))