Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Web Security TippsAssign temporary administrator roles in the Google Admin console(23.09.2026 um 23:23 Uhr)
Sichere ProgrammierungIs GEO only in our heads, or something real?(24.09.2026 um 01:43 Uhr)
Sichere ProgrammierungScoped Permission Error in One Code Branch (Capability Evidence First)(24.09.2026 um 01:48 Uhr)
Web Security TippsAssign temporary administrator roles in the Google Admin console(23.09.2026 um 23:23 Uhr)
Sichere ProgrammierungIs GEO only in our heads, or something real?(24.09.2026 um 01:43 Uhr)
Sichere ProgrammierungScoped Permission Error in One Code Branch (Capability Evidence First)(24.09.2026 um 01:48 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Day -2 : Mastering basics of Python

Operators in python 1. Arithmetic Operators Used for basic mathematical calculations. + (Addition): Adds two numbers. Example: 5 + 3 → 8 - (Subtraction): Subtracts the second number from the first. Example: 5 - 3 → 2 * (Mu…

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




Operators in python






1. Arithmetic Operators



Used for basic mathematical calculations.




  • + (Addition): Adds two numbers.


    Example: 5 + 3 → 8


  • - (Subtraction): Subtracts the second number from the first.


    Example: 5 - 3 → 2


  • * (Multiplication): Multiplies two numbers.


    Example: 5 * 3 → 15


  • / (Division): Divides the first number by the second, returning a float.


    Example: 5 / 2 → 2.5


  • // (Floor Division): Divides and rounds down to the nearest integer.


    Example: 5 // 2 → 2


  • % (Modulus): Returns the remainder of the division.


    Example: 5 % 2 → 1


  • ` (Exponentiation):** Raises the first number to the power of the second.

    Example:
    5 ** 2 → 25`





# Arithmetic Operators
a = 10
b = 3

print("Addition:", a + b) # 13
print("Subtraction:", a - b) # 7
print("Multiplication:", a * b) # 30
print("Division:", a / b) # 3.333...
print("Floor Division:", a // b) # 3
print("Modulus:", a % b) # 1
print("Exponentiation:", a ** b) # 1000












2. Assignment Operators



Used to assign values to variables.




  • = (Assign): Assigns a value to a variable.


    Example: x = 5


  • += (Add and Assign): Adds a value and reassigns.


    Example: x += 3 → x = x + 3


  • -= (Subtract and Assign): Subtracts a value and reassigns.


    Example: x -= 3 → x = x - 3


  • *= (Multiply and Assign): Multiplies a value and reassigns.


    Example: x *= 3 → x = x * 3


  • /= (Divide and Assign): Divides a value and reassigns.


    Example: x /= 3 → x = x / 3


  • //= (Floor Divide and Assign): Floor divides and reassigns.


    Example: x //= 3 → x = x // 3


  • %= (Modulus and Assign): Applies modulus and reassigns.


    Example: x %= 3 → x = x % 3


  • `= (Exponentiate and Assign):** Raises to a power and reassigns.

    Example:
    x *= 2 → x = x * 2`





# Assignment Operators
x = 5
print("Initial value:", x) # 5

x += 3
print("After += 3:", x) # 8

x -= 2
print("After -= 2:", x) # 6

x *= 4
print("After *= 4:", x) # 24

x /= 3
print("After /= 3:", x) # 8.0

x //= 2
print("After //= 2:", x) # 4.0

x %= 3
print("After %= 3:", x) # 1.0

x **= 2
print("After **= 2:", x) # 1.0












3. Comparison Operators



Used to compare two values.




  • == (Equal to): Checks if two values are equal.


    Example: 5 == 5 → True


  • != (Not Equal to): Checks if two values are not equal.


    Example: 5 != 3 → True


  • > (Greater than): Checks if the first value is greater than the second.


    Example: 5 > 3 → True


  • < (Less than): Checks if the first value is less than the second.


    Example: 3 < 5 → True


  • >= (Greater than or Equal to): Checks if the first value is greater than or equal to the second.


    Example: 5 >= 5 → True


  • <= (Less than or Equal to): Checks if the first value is less than or equal to the second.


    Example: 3 <= 5 → True





# Comparison Operators
a = 10
b = 5

print("Equal:", a == b) # False
print("Not Equal:", a != b) # True
print("Greater than:", a > b) # True
print("Less than:", a < b) # False
print("Greater or Equal:", a >= b) # True
print("Less or Equal:", a <= b) # False












4. Logical Operators



Used for combining conditions.




  • and: Returns True if both conditions are true.


    Example: (5 > 3) and (4 > 2) → True


  • or: Returns True if at least one condition is true.


    Example: (5 > 3) or (2 > 4) → True


  • not: Reverses the truth value.


    Example: not(5 > 3) → False





# Logical Operators
a = True
b = False

print("AND:", a and b) # False
print("OR:", a or b) # True
print("NOT a:", not a) # False
print("NOT b:", not b) # True












5. Bitwise Operators



Operate on binary representations of numbers.




  • &: Performs bitwise AND.


    Example: 5 & 3 → 1


  • |: Performs bitwise OR.


    Example: 5 | 3 → 7


  • ^: Performs bitwise XOR.


    Example: 5 ^ 3 → 6


  • ~: Performs bitwise NOT.


    Example: ~5 → -6


  • <<: Shifts bits to the left.


    Example: 5 << 1 → 10


  • >>: Shifts bits to the right.


    Example: 5 >> 1 → 2





# Bitwise Operators
a = 5 # Binary: 0101
b = 3 # Binary: 0011

print("Bitwise AND:", a & b) # 1 (Binary: 0001)
print("Bitwise OR:", a | b) # 7 (Binary: 0111)
print("Bitwise XOR:", a ^ b) # 6 (Binary: 0110)
print("Bitwise NOT (~a):", ~a) # -6
print("Left Shift:", a << 1) # 10 (Binary: 1010)
print("Right Shift:", a >> 1) # 2 (Binary: 0010)












6. Membership Operators



Check if a value is present in a sequence.




  • in: Returns True if the value is in the sequence.


    Example: 'a' in 'apple' → True


  • not in: Returns True if the value is not in the sequence.


    Example: 'z' not in 'apple' → True





# Membership Operators
sequence = [1, 2, 3, 4, 5]

print("3 in sequence:", 3 in sequence) # True
print("6 in sequence:", 6 in sequence) # False
print("6 not in sequence:", 6 not in sequence) # True












7. Identity Operators



Check if two variables reference the same object.




  • is: Returns True if two variables point to the same object.


    Example: x is y


  • is not: Returns True if two variables point to different objects.


    Example: x is not y





# Identity Operators
a = [1, 2, 3]
b = a
c = [1, 2, 3]

print("a is b:", a is b) # True (same object)
print("a is c:", a is c) # False (different objects)
print("a is not c:", a is not c) # True












8. Ternary Operator



The ternary operator allows a shorthand for if-else statements.




# Ternary Operator
a, b = 10, 20

max_value = a if a > b else b
print("Maximum value:", max_value) # 20












9. Walrus Operator (:=)



Introduced in Python 3.8, the walrus operator allows assignment inside expressions.




# Walrus Operator (Python 3.8+)
data = [1, 2, 3, 4, 5]

if (n := len(data)) > 3:
print("Length is greater than 3:", n) # 5












10. Enumerate with Loops



The enumerate() function returns both the index and the value of each item in an iterable.




# Enumerate with Loops
colors = ["red", "green", "blue"]
for index, color in enumerate(colors):
print(f"{index}: {color}")


CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Vulnerability Remediation & Verification
title: Detect Exploitation - Day -2 : Mastering basics of Python
id: 3f8497a5-8651-4683-a056-5607c6cd2099
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
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
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Day -2 : Mastering basics of P" ascii wide
    condition:
        any of them
}
Infrastructure Blast Radius & Exposure
LOCALIZED
Perimeter & External Ingress
GEFÄHRDET (85%)
Lateral Movement & Pivot
Geringes Risiko
Data Stores & Crown Jewels
Geringes Risiko
Supply Chain & Cascading Reach
Geringes Risiko
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Day -2 : Mastering basics of Python.... 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 Day -2 : Mastering basics of Python

Thematisch verwandte Begriffe: Mastering, basics, Python · 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 ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96676 | A vulnerability was identified in Fast FAC1900R 20190827_2.0.2. The impa…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
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
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick