Answered You can hire a professional tutor to get the answer.

QUESTION

Assign True to the variable has_dups if the string s1has any duplicate character (that is if any character appears more than once) and False

Assign True to the variable  has_dups if the string s1has any duplicate character (that is if any character appears more than once) and False otherwise

this is what I got so far 

i = []for i in range(len([s1])):if s1.count(s1[i]) > 1:has_dups = Trueelse:has_dups = False

but the program gives me an error  Exception occurred(<class 'IndexError'>, IndexError('string index out of range',), <traceback object at 0x7fc8bf95c8c8>)

i = s1 =&quot;abcdeasa&quot;; for i in range(len([s1])): if s1.count(s1[i]) &gt; 1: has_dups = True else: has_dups = False print has_dups
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question