Home/Support/Support Forum/Python coding
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Python coding

0 votes
Hi, I am new to python and i have a simple program to code using basic for / if loop without using any python inbuilt functions. I should write a function which takes an input string and outputs a string from the first occurrence of each element in string... for eg: if i input "mississippi" my output should be "misp", if input is "abcdefg" then output should be "abcdefg" and so on...basically it should delete all the duplicate elements and return the sequence without repetition.
asked Oct 28, 2013 in Python by donsuni New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
one way to do this would be to build a list for each character encountered. As you advance through the string you're checking each one. If the character is in your encountered list, 'delete' it and move to the next. If it isn't, add it and move to the next.
answered Oct 30, 2013 by kjensen8 Veteran of the Digi Community (623 points)
...