🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)
🕵️ SicherheitslückenCVE-2026-11736 | NETGEAR XR1000v2 input validation(13.09.2026 um 03:22 Uhr)
🕵️ SicherheitslückenCVE-2026-11734 | NETGEAR RAX54Sv2 buffer overflow(13.09.2026 um 03:22 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)
🕵️ SicherheitslückenCVE-2026-11736 | NETGEAR XR1000v2 input validation(13.09.2026 um 03:22 Uhr)
🕵️ SicherheitslückenCVE-2026-11734 | NETGEAR RAX54Sv2 buffer overflow(13.09.2026 um 03:22 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

Day 21- String Functions

↗ Quelle (dev.to)
🗣️ Stimme:

Write a program to check the given key is title or not.



istitle()- Check the first letter of each word is capitalized, and all other letters in the word are lowercase.




CODE
txt = 'Rose Is A Beautiful Flower'

if txt[0]>='a' and txt[0]<='z':
print("No Title is there")
else:
i = 1
while i<len(txt)-1:
if txt[i]==' ':
if txt[i+1]>='A' and txt[i+1]<='Z':
pass
else:
print("No Title is there")
break
i+=1
else:
print("Title is there")









CODE
Title is there







Write a program to replace a word by another word.



replace()-replace occurrences of a substring within a string with another substring.




CODE
txt = "I like bananas"
already = "bananas"
new = "apples"

l = len(already) # l = 7
start = 0
end = l
while end<=len(txt):
if txt[start:end] == 'bananas':
txt = txt[:start] + new
start+=1
end+=1
else:
print(txt)









CODE
I like apples







In Python everything is an object.

Every object can create a different memory space.

String is immutable(Not changeable).

Identical objects can refer the same memory.




CODE
country1 = 'India'
country2 = 'India'
country3 = 'India'
country4 = 'India'
print(id(country1))
print(id(country2))
print(id(country3))
print(id(country4))
country1 = "Singapore"
print(id(country1))









CODE
135098294846640
135098294846640
135098294846640
135098294846640
135098292962352






If we try to edit an existing string,it won't get changed. Instead, a new memory will be created for storing the new value.



Difference between rfind() and rindex():



Both methods search for the last occurrence of a specified substring, but they behave differently when the substring is absent.




CODE
txt = "Mi casa, su casa."

x = txt.rfind("casa")
print(x)
x = txt.rindex("casa")
print(x)









CODE
12
12









CODE
txt = "Mi casa, su casa."

x = txt.rfind("basa")
print(x)
x = txt.rindex("basa")
print(x)









CODE
-1
ValueError: substring not found






rfind()-If not found: Returns -1

rindex()-If not found: Raises a ValueError



Write a program to check a given key is available or not.

(rfind() or rindex())





CODE
txt = "Python is my favourite language"
key = 'myy'
l = len(key)
start = 0
end = l

while end<=len(txt):
if txt[start:end] == key:
print(start)
break
start += 1
end += 1
else:
print('-1 or ValueError')









CODE
-1 or ValueError






Write a program to split given text.



split()- to divide a string into a list of substrings based on a specified separator.




CODE
txt = "Today is Wednesday"
word = ''
start = 0
i = 0
while i<len(txt):
if txt[i]==' ':
print(txt[start:i])
start = i+1
elif i == len(txt)-1:
print(txt[start:i+1])
i+=1









CODE
Today
is
Wednesday



Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Check Point Patches Critical VPN Vulnerabilities
1 Quelle
Ukrainian Conti Ransomware Developer Sentenced to 4 Years in US Prison
1 Quelle
GitLab Vulnerability Exploited One Day After Disclosure
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Day 21- String Functions

Thematisch verwandte Begriffe: String, Functions · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...