Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Python Day-22 String Functions logic using loops, Recursion, Tasks

1) To add space between strings txt = "TodayIsFriday" #Today is Friday first = True for letter in txt: if letter>='A' and letter<='Z': if first==True: first = False else: print('…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

1) To add space between strings




txt = "TodayIsFriday"
#Today is Friday
first = True
for letter in txt:
if letter>='A' and letter<='Z':
if first==True:
first = False
else:
print(' ',end='')
print(letter,end='')






Output:

Today Is Friday



2)To remove space between strings




txt = "    Today Is Friday"
#Today is Friday

for letter in txt:
if letter==' ':
pass
else:
print(letter,end='')






Output:

TodayIsFriday



3) ltrim- To remove spaces in left side of the strings.




#ltrim
txt = " Today Is Friday"
#Today is Friday
alphabet = False
for letter in txt:
if letter==' ' and alphabet == False:
pass
else:
alphabet = True
print(letter,end='')






4) rtrim- To remove spaces in right side of the strings.




txt = "Today Is Friday   "
#Today is Friday
alphabet = False
i = len(txt)-1
while i>=0:
letter = txt[i]
if letter==' ' and alphabet == False:
pass
else:
alphabet = True
end = i
j = 0
while j<=end:
print(txt[j],end='')
j+=1
break
i-=1






Output:



Today Is Friday



5) Removing Unwanted spaces from given String




txt = "Today          Is             Friday"
#Today is Friday
i = 0
while i<len(txt):
if txt[i] != ' ':
print(txt[i],end='')
else:
if txt[i-1]!=' ':
print(txt[i],end='')
i+=1






Output:



Today Is Friday



Recursion:

Function calling itself.



Looping-->Iterative approach.

Recursion-->Recursive approach.



Example:1




def display(no):
print(no, end=' ')
no+=1
if no<=5:
display(no)


display(1)






Output:




1 2 3 4 5






Recursive function for calling factorial:



5!=5x4x3x2x1 (or) 5x4!



4!=4x3x2x1 (or) 4x3!



3!=3x2x1 (or) 3x2!



2!=2x1 (or) 2x1!



1!=1



Example:2




def find_fact(no):
if no==1:
return 1
return no * find_fact(no-1)

result = find_fact(5)
print(result)






Output:

120



Explanation:

1) find_fact(5)

Returns 5 * find_fact(4) #no-1 = 5-1 -->4



2) find_fact(4)

Returns 4 * find_fact(3) #no-1 = 4-1 -->3



3) find_fact(3)

Returns 3 * find_fact(2) #no-1 = 3-1 -->2



4) find_fact(2)

Returns 2 * find_fact(1) #no-1 = 2-1 -->1



5) find_fact(1)

Base case: Returns 1



Base case: The base case in recursion is a condition that stops the recursive calls.



Tasks:



strip()-Removes all white space characters (spaces, tabs, newlines) from the start and end of the string.



1) Remove unwanted spaces in front and back of the given string.




txt = "    Today Is Friday   "

start = 0
end = len(txt) - 1

while start < len(txt) and end >= 0:

i = start
while i < len(txt) and txt[i] == ' ':
i += 1
start = i

j = end
while j >= 0 and txt[j] == ' ':
j -= 1
end = j
break

result = txt[start:end+1]
print(result)






Output:




Today Is Friday






2) Reversing a number using recursive function:




def reverse_a_no(no,reverse = 0):
if no==0:
return reverse
rem = no%10
reverse = (reverse*10) + rem
no=no//10
return reverse_a_no(no,reverse)

no = int(input("Enter no. "))
reversed_no = reverse_a_no(no)
print(reversed_no)






Output:




Enter no. 15
51






3)Find prime number or not:




def find_prime(no,div=2):
if div<no:
if no%div == 0:
return False
div+=1
return find_prime(no,div)
else:
return True

no=int(input("Enter the number: "))

if find_prime(no):
print("EMIRP number")
else:
print("not EMIRP number")






Output:




1) Enter the number: 11
EMIRP number
2) Enter the number: 15
not EMIRP number






4) Find fibonacci:




def find_fibonacci(first_num,sec_num,no):
if first_num > no:
return
print(first_num, end=" ")

find_fibonacci(sec_num,first_num+sec_num,no)

no = int(input("Enter the number: "))
find_fibonacci(0,1,no)






Output:




Enter the number: 10
0 1 1 2 3 5 8






5. Find palindrome or not:




def palindrome(num,count=0):
if num == 0:
return count
return palindrome(num//10,count*10+num%10)

num=int(input("Enter the number:"))
result=palindrome(num)
if result==num:
print("Palindrome")
else:
print("Not palindrome")






Output:




Enter the number:121
Palindrome






Created HackerRank Account: https://www.hackerrank.com/dashboard

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Vulnerability Remediation & Verification
Syntax validiert (0 Fehler)
title: Detect Exploitation - Python Day-22 String Functions logic using loops, Recursion, Tasks
id: 82048cbc-ee0b-4f6c-ad72-a4add175d250
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-26
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-26"
        description = "YARA Signature for "
    strings:
        $str = "Python Day-22 String Functions" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("Python Day-22 String Functions logic usi")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*Python Day-22 String Functions logic usi*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "Python Day-22 String Functions logic usi"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Python Day-22 String Functions logic usi.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Python Day-22 String Functions logic using loops, Recursion, Tasks

Thematisch verwandte Begriffe: Python, Day22, 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 ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-100618 | Capgo (capgo.app) is affected by an authorization flaw in the app icon …
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag