🕵️ SicherheitslückenCVE-2026-85014 | undici up to 7.29.0/8.10.1 Socket Close denial of service(16.09.2026 um 04:26 Uhr)
🕵️ SicherheitslückenCVE-2026-85014 | undici up to 7.29.0/8.10.1 Socket Close denial of service(16.09.2026 um 04:26 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 3 Min Lesezeit
0

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

↗ Quelle (dev.to)
🗣️ Stimme:

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.




CODE
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:




CODE
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:




CODE
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.




CODE
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

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ 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
7 Quellen
CVE-2024-44965 | Linux Kernel up to 6.10.4 pti_clone_pgtable stack-based overflow (Nessus ID 208953 / WID-SEC-2024-2057)
3 Quellen
CVE-2026-84961 | undici up to 7.29.0/8.10.1 BalancedPool BalancedPool constructor connect/tls certificate validation
3 Quellen
CVE-2026-84657 | Jenkins up to 2.567.x CLI permission
Ä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 ...