Artificial Intelligence
56.5K subscribers
488 photos
5 videos
120 files
423 links
🔰 Machine Learning & Artificial Intelligence Free Resources

🔰 Learn Data Science, Deep Learning, Python with Tensorflow, Keras & many more

For Promotions: @love_data
Download Telegram
word = "Python"
word[0] = "J"


Instead, you create a new string:

word = "Python"
word = "J" + word[1:]
print(word) # Jython


9. String Concatenation

You can combine strings using +.

first_name = "Alice"
last_name = "Smith"
full_name = first_name + " " + last_name
print(full_name) # Alice Smith


10. f-Strings

f-strings provide a convenient way to insert variables into strings.

name = "Alice"
age = 25
message = f"My name is {name} and I am {age} years old."
print(message) # My name is Alice and I am 25 years old.


f-strings are widely used because they make formatted text easier to read.

11. Strings in AI and NLP

Strings become especially important when you move into Artificial Intelligence. AI systems frequently work with text such as: User questions, Chat messages, Documents, Reviews, Emails, Search queries, AI prompts.

Before text can be processed by many NLP and LLM systems, it often needs to be cleaned, transformed, tokenized, or converted into numerical representations.

For example:

text = " AI is AMAZING! "
cleaned_text = text.strip().lower()
print(cleaned_text) # ai is amazing!


This is a very simple example of text preprocessing.

Common Beginner Mistakes

❌ Forgetting that indexing starts at 0.

❌ Assuming the end index in slicing is included.

❌ Trying to modify an individual character.

❌ Confusing split() with join().

❌ Forgetting that spaces count toward string length.

Best Practices

✅ Use meaningful variable names.

✅ Use appropriate string methods instead of manually processing characters when possible.

✅ Use f-strings for readable string formatting.

✅ Remember that strings are immutable.

Key Takeaways

• A string is a sequence of characters.

• Python uses zero-based indexing.

• Negative indexing starts from -1.

• Slicing extracts portions of a string.

• len() returns the number of characters.

• Strings are immutable.

• Methods such as upper(), lower(), strip(), split(), and replace() are extremely useful.

• Strings are fundamental to NLP, LLMs, and AI applications.

➡️ Double Tap ❤️ For More
❤14👏2
✈️ Flight cancelled. Connection missed. What does your AI agent do?

Build the agent that checks flights, reads the policy and recommends the right option.

That's one of the capstone projects in the Certification in Agentic AI by Vishlesan i-Hub, IIT Patna.

✅ 4 Months | Online | 10 hrs/week | Live classes
✅ 6+ course projects, 15+ tools
✅ Learn Python, RAG, LangChain, LangGraph & FastAPI
✅ Placement assistance for 1 year, plus resume review & interview coaching by Masai*

📅 Qualifier Test: 25th Oct
Test fee: ₹29

🔗 https://tinyurl.com/aff-iitp-agai

*Eligibility: 7+ CGPA and 65% attendance