Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Web Security TippsNew manual calculation setting in Google Sheets(21.09.2026 um 20:54 Uhr)
Videos & KonferenzenTechquickie: The Steam Frame Shouldn't Work - Here's Why It Does(21.09.2026 um 21:17 Uhr)
Sichere ProgrammierungHow to Build a Production-Ready iOS App With AI-Generated Code(21.09.2026 um 21:00 Uhr)
Sichere ProgrammierungAfriex Integrations: Sandbox, Idempotency, and Webhook Simulation(21.09.2026 um 21:50 Uhr)
Sichere ProgrammierungBridging Local and Cloud Databases for Centralized Data Management(21.09.2026 um 21:51 Uhr)
Web Security TippsNew manual calculation setting in Google Sheets(21.09.2026 um 20:54 Uhr)
Videos & KonferenzenTechquickie: The Steam Frame Shouldn't Work - Here's Why It Does(21.09.2026 um 21:17 Uhr)
Sichere ProgrammierungHow to Build a Production-Ready iOS App With AI-Generated Code(21.09.2026 um 21:00 Uhr)
Sichere ProgrammierungAfriex Integrations: Sandbox, Idempotency, and Webhook Simulation(21.09.2026 um 21:50 Uhr)
Sichere ProgrammierungBridging Local and Cloud Databases for Centralized Data Management(21.09.2026 um 21:51 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

# Day 2: Variables, Data Types & Conditionals in Python — With a Real Project!

By Hillary Nartey | AI Data Specialist in Training Welcome Back! This is Day 2 of my Python learning journey. If you missed Day 1, I shared how I got started, the free tools I am using, and why I chose Python as my first…

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

By Hillary Nartey | AI Data Specialist in Training






Welcome Back!



This is Day 2 of my Python learning journey. If you missed Day 1, I shared how I got started, the free tools I am using, and why I chose Python as my first programming language.



Today I covered three important Python basics:




  • Variables

  • Data Types

  • Conditionals (if, elif, else)



And the best part? I built a small real-world project to practice everything together!



Variables



A variable is simply a container that stores a value. Think of it like a labeled box where you keep information.




name = "Hillary"
age = 25
price = 9.99






Each of these is a variable. name stores text, age stores a whole number, and price stores a decimal number.



Data Types



In Python, every value has a data type. Here are the basic ones I learned today:

































Data Type Example Description
int 25 Whole numbers
float 9.99 Decimal numbers
str "Hillary" Text (string)
bool True / False Yes or No values


You can also tell Python exactly what type a variable should be. For example:




amount: int = int(input("Enter your shopping amount: "))






Here I am telling Python that amount should be an integer, and I am converting the user's input into one using int().



Conditionals (if, elif, else)



Conditionals let your program make decisions. It checks a condition and runs different code depending on whether it is TRUE or FALSE.



The basic structure looks like this:




if condition:
# do this
elif another_condition:
# do this instead
else:
# do this if nothing above is true






My Mini Project: Shopping Discount Calculator 🛒



To practice everything I learned today, I built a simple shopping discount calculator. It takes the amount a customer spends and automatically calculates their discount and final price.




amount: int = int(input("Enter your shopping amount: "))

if amount < 50:
discount = 0
print("No discount")
elif amount >= 50 and amount <= 99:
discount = 0.10
print("You have 10% discount")
elif amount >= 100 and amount <= 199:
discount = 0.20
print("You have 20% discount")
else:
discount = 0.30
print("You have 30% discount")

final = amount * (1 - discount)

if final > 150:
print("You are a big spender")
else:
print("Great deal")

print(f"Your final price is: ${final}")






How it works:




  • The user enters how much they are spending

  • The program checks which discount range they fall into

  • It calculates the final price after the discount

  • It also checks if the final amount makes them a "big spender."



For example, if you enter $120:




  • You get a 20% discount

  • Your final price becomes $96.00

  • And you get a "Great deal" message!



What I Learned From This Project



Building this small project taught me more than just reading about variables and conditionals. I learned how to:




  • Take user input with input()

  • Convert data types using int()

  • Use multiple conditions with elif

  • Combine conditions using and.

  • Calculate values using arithmetic operators

  • Display results using f-strings like f"Your final price is: ${final}".



Key Takeaways from Day 2




  • Variables store information that your program can use

  • Data types tell Python what kind of information is being stored

  • Conditionals allow your program to make decisions

  • The best way to learn is to build something — even something small!



What's Coming on Day 3?



Next, I plan to cover:




  • Lists — storing multiple values in one variable

  • Loops — repeating actions automatically

  • Another small project to practice!



Thanks for following along! If you are also a beginner, drop a comment below — let's learn together! 🚀



Written by Hillary Nartey | AI Data Specialist in Training

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten # Day 2: Variables, Data Types & Conditionals in Python — With a Real Project!

Thematisch verwandte Begriffe: Variables, Data, Types, Conditionals · 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-94497 | jshERP through 3.6 fails to validate object ownership in by-id info, upd…
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