How would you extract the substring that comes after the dot in a string such as 'a.com'?
1Times asked
Oct 2026Last seen
Oct 2026First seen
💡 Model Answer
You can split the string on the dot and take the part after it: part = s.split('.')[-1] which gives 'com'. Alternatively, use partition: _, _, part = s.partition('.') which also returns 'com'. Both approaches are O(n) and work for any string containing a dot.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500