GOEDUHUB Online Courses || Last Batch Student's Projects || COVID-19 Projects(AI-ML) || Universities  ||  Placement Preparation  Subscribe our youtube channel
+91-7976731765 Free Online Tutorials ||  MACHINE LEARNING || Python || DBMS || OOPs || DSA || Java || Linux/Unix ||  C Programming
Register For Online Free Certified Workshops 
0 like 0 dislike
44 views
in Python Programming by Goeduhub's Expert (8k points)

Enter a string:sakshi sak$hi

1 Answer

0 like 0 dislike
by Goeduhub's Expert (8k points)
 
Best answer

Method 1-

c = input()

temp = c[0]

for i in range(1,len(c)):

    if(c[0] == c[i] ):

        temp = temp + '$'

    else:

        temp = temp + c[i]

print(temp) 

Method 2-

s=input("Enter a string:")

char=s[0]

s=s.replace(char,'$')

s=char+s[1:]

print(s)

 Placements:   List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Important Lists: List of NITsList of IITsList of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG)College ReviewsCollege Fest, Events & WorkshopsKnowledge ShareTrainees/Interns After 15-04-2020
Exams & Cutoffs: JEE Main | JEE Advanced | GATE | IES | ISRO List of PSUs || Cutoff-GATECutoff_IIT-JEECS-ScopeECE ScopeEE-Scope
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Goeduhub
About Us | Contact Us   Social::   |  | 
...