Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungLINQ GroupBy: The Operator Everyone Uses Wrong(23.09.2026 um 09:41 Uhr)
Sichere ProgrammierungIT Heard About the Acquisition Nine Days Before It Closed(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungThe Story Behind Building NuvyntraLabs(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungFive dashboards nobody was opening(23.09.2026 um 09:46 Uhr)
Sichere ProgrammierungThe Shift from AI Insights to AI Actions in Finance(23.09.2026 um 09:47 Uhr)
Sichere ProgrammierungGo WebAssembly Meets WebForms Core 2.1(23.09.2026 um 09:49 Uhr)
Sichere ProgrammierungJust One More Round: Scope Creep in the Age of AI Agents(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungThe Calls That Reach Us Now Are the Ones the Model Could Not Answer(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungOne Loop Made Four Hundred Round Trips(23.09.2026 um 09:52 Uhr)
Sichere ProgrammierungThe order was committed and nothing else ever heard about it(23.09.2026 um 09:53 Uhr)
Sichere ProgrammierungLINQ GroupBy: The Operator Everyone Uses Wrong(23.09.2026 um 09:41 Uhr)
Sichere ProgrammierungIT Heard About the Acquisition Nine Days Before It Closed(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungThe Story Behind Building NuvyntraLabs(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungFive dashboards nobody was opening(23.09.2026 um 09:46 Uhr)
Sichere ProgrammierungThe Shift from AI Insights to AI Actions in Finance(23.09.2026 um 09:47 Uhr)
Sichere ProgrammierungGo WebAssembly Meets WebForms Core 2.1(23.09.2026 um 09:49 Uhr)
Sichere ProgrammierungJust One More Round: Scope Creep in the Age of AI Agents(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungThe Calls That Reach Us Now Are the Ones the Model Could Not Answer(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungOne Loop Made Four Hundred Round Trips(23.09.2026 um 09:52 Uhr)
Sichere ProgrammierungThe order was committed and nothing else ever heard about it(23.09.2026 um 09:53 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Python Variables and Data Types – A Beginner-Friendly Guide

What is a Variable? A variable is a name that refers to a value stored in memory. It acts as a container to hold data that can be reused or manipulated throughout a program. Rules to Declare a Variable in Python: Must start…

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




What is a Variable?



A variable is a name that refers to a value stored in memory. It acts as a container to hold data that can be reused or manipulated throughout a program.






Rules to Declare a Variable in Python:




  • Must start with a letter (a–z, A–Z) or an underscore (_)

  • Can contain letters, digits, and underscores

  • Cannot start with a digit

  • Are case-sensitive (age and Age are different)

  • Must not be a Python keyword (e.g., class, for)



✅ Valid Examples:




_name = "John"
user1 = 25






❌ Invalid Examples:




1user = "invalid"  # starts with digit
for = 5 # 'for' is a keyword











Mutable vs Immutable Data Types:




  • Immutable: An immutable value is one whose content cannot be changed without creating an entirely new value.


  • Mutable: A mutable value is one that can be changed without creating an entirely new value.









Primitive Data Types:



A primitive type is predefined by the programming language and cannot be broken down into simpler structures.



1. int (Immutable): stores integer numbers like 10, -3, 0




x = 10
print(type(x))
# Output: <class 'int'>






2. float (Immutable): stores decimal numbers like 10.3, -3.1, 0.1




x = 0.1
print(type(x))
# Output: <class 'float'>






3. bool (Immutable): stores boolean values True/False




x = True
print(type(x))
# Output: <class 'bool'>






4. str (Immutable): stores sequence of characters like 'hello world!'




x = 'Hello World!'
print(type(x))
# Output: <class 'str'>






5. NoneType (Immutable): Represents “no value”




x = None
print(type(x))
# Output: <class 'NoneType'>











Non-Primitive Data Types:



A non-primitive data type is one that is derived from Primitive data types and these data types are not actually defined by the programming language but are created by the programmer. Non-primitive data types are called reference types because they refer to objects.



1. list (Mutable): Stores Ordered and mutable collection of data that allows duplicates.




x = [1, "Hello", True, 2, None]
print(type(x))
# Output: <class 'list'>






2. tuple (Immutable): Stores Ordered and read-only collection of data that allows duplicates.




x = (1, "Hello", True, 2, None)
print(type(x))
# Output: <class 'tuple'>






3. set (Mutable): Stores Unordered and mutable collection of data that does not allow duplicates.




x = {1, 2, 3, 4, 5}
print(type(x))
# Output: <class 'set'>






4. dict (Mutable): Stores data in Key-value pairs.




x = {
"name": "John",
"age": 25,
"phone": "1234567890"
}
print(type(x))
# Output: <class 'dict'>


Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Python Variables and Data Types – A Beginner-Friendly Guide

Thematisch verwandte Begriffe: Python, Variables, Data, Types · 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-96258 | A vulnerability has been found in onSite internet GmbH Auktion NG Auktio…
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 ⏱️ 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