Q.No.1 - Write a function that takes a string as parameter and returns a string with every successive repetitive character replaced by ‘!’

Sol.-

s=input("Enter Your String")
a=0
s2=""
for i in s:   
    if s.index(i)==a :
        s2=s2+i
    else:
        s2=s2+"!"
    a=a+1
print(s2)


Explain :
Step 1: User Enter the string.
Step 2: We declare a=0 and s="" (Create an Empty String)
Step 3: For loop start- Check condition if s.index(i)==a - means s.index(i)- string.index  of i ( 1st letter) is =0. Yes so it can add to s2 (empty list).
Step 4: a value change to 1. Now loop i value also swtich to 1 indexing value no.
Step 5: When s.index(i)==a condition fail then it switch to else condtion and add that point it add "!" to string.
Step 6: Whne loop complete it print string (s2).

OUTPUT: