Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

first unique character in a string in python

def firstUniqChar(s):
    data = {}
    for i in range(len(s)):
        if s[i] not in data:
            data[s[i]] = i
        else:
            data[s[i]] = -1

    for i in data.values():
        if i >= 0:
            return i
    return -1
Comment

PREVIOUS NEXT
Code Example
Python :: list of files to zip python 
Python :: python open a+ 
Python :: python list of all characters 
Python :: slack send message python 
Python :: display video in jupyter notebook 
Python :: printing python dictionary values 
Python :: python dataframe shape 
Python :: python copy dataframe 
Python :: numpy check if 2 array identical 
Python :: df concat 
Python :: pytest parametrize 
Python :: star pattern in python 
Python :: how to add subplots for histogram 
Python :: django try catch exception 
Python :: python if string is null or whitespace 
Python :: generic python 
Python :: python version installed in ubuntu 
Python :: how to take unknown number of inputs in python 
Python :: python read line into list 
Python :: tkinter radio buttons 
Python :: python remove form list 
Python :: how to 404 custom page not found in django 
Python :: promote a row in panda dataframe to header 
Python :: how to execute python program in ubuntu 
Python :: python set remove 
Python :: how to create a countdown timer using python 
Python :: no such table: django_session admin 
Python :: python program to add two numbers 
Python :: distinct rows in this DataFrame 
Python :: model o weight 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =