I am new to programming and recently started learning strings and loops. I want to know is it possible to assign the index of any alphabet from a string to a variable?
def max_char(a_string):
val="abcdefghijklmnopqrstuvwxyz"
counter=0
for i in range (len(val)):
for k in range(len(a_string)):
if val[i] == a_string[k]:
if counter==0:
x1=val.index(i) #here I want to assign the index of ith element of val to x1. Also tried *x1=val[i].index*
counter=1