🔧 AI Nachrichten KI-Angriffe: Geheimdienste sollen neue Befugnisse erhalten(11.09.2026 um 11:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🐧 Linux TippsPACMAN: KI-Framework steuert Fusionsplasma in Echtzeit(11.09.2026 um 10:46 Uhr)
📰 IT NachrichtenAutismus und ADHS mit früher Weichmacher-Exposition verknüpft(12.09.2026 um 09:04 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)
⚠️ Malware / Trojaner / VirenNeue Android-Malware schreit Sie an, wenn Sie nicht zahlen(11.09.2026 um 10:33 Uhr)
📰 IT Nachrichten7-max: Tool bringt 10 bis 20 Prozent mehr Tempo für Programme(12.09.2026 um 09:30 Uhr)
⚠️ Malware / Trojaner / VirenHandy: Wer diese App installiert hat, sollte sein Gerät besser zurücksetzen(11.09.2026 um 16:55 Uhr)
🔧 AI Nachrichten KI-Angriffe: Geheimdienste sollen neue Befugnisse erhalten(11.09.2026 um 11:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🐧 Linux TippsPACMAN: KI-Framework steuert Fusionsplasma in Echtzeit(11.09.2026 um 10:46 Uhr)
📰 IT NachrichtenAutismus und ADHS mit früher Weichmacher-Exposition verknüpft(12.09.2026 um 09:04 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)
⚠️ Malware / Trojaner / VirenNeue Android-Malware schreit Sie an, wenn Sie nicht zahlen(11.09.2026 um 10:33 Uhr)
📰 IT Nachrichten7-max: Tool bringt 10 bis 20 Prozent mehr Tempo für Programme(12.09.2026 um 09:30 Uhr)
⚠️ Malware / Trojaner / VirenHandy: Wer diese App installiert hat, sollte sein Gerät besser zurücksetzen(11.09.2026 um 16:55 Uhr)

🔧 Programmierung 🕛 vor 1 Monat 5 Min Lesezeit
0

Python Fundamentals for a JavaScript Developer

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

I'll guide you through Python fundamentals by comparing concepts with JavaScript. Let's start!






1. Hello World & Basic Syntax






JavaScript






CODE
console.log("Hello World");
let x = 5;









Python






CODE
print("Hello World")
x = 5 # No semicolon, no let/const






Key Differences:




  • No semicolons in Python

  • Indentation matters (replaces curly braces)

  • Comments use # instead of //






2. Variables & Data Types






JavaScript






CODE
let name = "Alice";  // string
let age = 30; // number
let isStudent = true; // boolean
let scores = [95, 87, 91]; // array
let person = { // object
name: "Bob",
age: 25
};
let nothing = null;
let notDefined = undefined;









Python






CODE
name = "Alice"        # str
age = 30 # int (or float for decimals)
is_student = True # bool (capital T/F)
scores = [95, 87, 91] # list (mutable)
person = { # dict (dictionary)
"name": "Bob",
"age": 25
}
nothing = None # Python's null/undefined






Key Differences:




  • Python uses snake_case (not camelCase)


  • True/False capitalized


  • None instead of null/undefined

  • Lists ≈ Arrays, Dicts ≈ Objects






3. Control Flow






JavaScript






CODE
// If-else
if (age >= 18) {
console.log("Adult");
} else if (age >= 13) {
console.log("Teen");
} else {
console.log("Child");
}

// For loop
for (let i = 0; i < 5; i++) {
console.log(i);
}

// While loop
let count = 0;
while (count < 5) {
console.log(count);
count++;
}









Python






CODE
# If-else (indentation instead of braces)
if age >= 18:
print("Adult")
elif age >= 13: # NOT else if
print("Teen")
else:
print("Child")

# For loop (more like for...of in JS)
for i in range(5): # range(5) = [0, 1, 2, 3, 4]
print(i)

# Iterate over list (like for...of)
for score in scores:
print(score)

# While loop
count = 0
while count < 5:
print(count)
count += 1 # No ++ operator in Python









4. Functions






JavaScript






CODE
// Function declaration
function add(a, b) {
return a + b;
}

// Arrow function
const multiply = (a, b) => a * b;

// Default parameters
function greet(name = "Guest") {
return `Hello ${name}`;
}









Python






CODE
# Function definition (def instead of function)
def add(a, b):
return a + b # Indented body

# Lambda functions ≈ Arrow functions
multiply = lambda a, b: a * b

# Default parameters
def greet(name="Guest"):
return f"Hello {name}" # f-strings like template literals

# Multiple return values (tuples)
def get_coordinates():
return 10, 20 # Returns a tuple (10, 20)

x, y = get_coordinates() # Destructuring assignment









5. Data Structures Comparison






Arrays/Lists






CODE
// JavaScript Arrays
let arr = [1, 2, 3];
arr.push(4); // [1, 2, 3, 4]
arr.pop(); // [1, 2, 3]
let sliced = arr.slice(0, 2); // [1, 2]









CODE
# Python Lists
arr = [1, 2, 3]
arr.append(4) # [1, 2, 3, 4]
arr.pop() # [1, 2, 3] (removes last)
sliced = arr[0:2] # [1, 2] (slicing syntax)
arr.insert(1, 99) # [1, 99, 2, 3]

# List comprehension (unique to Python)
squares = [x**2 for x in range(5)] # [0, 1, 4, 9, 16]









Objects/Dictionaries






CODE
// JavaScript Objects
let person = {
name: "Alice",
age: 30,
greet() {
return `Hello, I'm ${this.name}`;
}
};
console.log(person.name);
console.log(person["age"]);









CODE
# Python Dictionaries
person = {
"name": "Alice",
"age": 30,
"greet": lambda self: f"Hello, I'm {self['name']}"
}
print(person["name"]) # Access with brackets
print(person.get("age")) # Safer access

# Methods don't naturally have 'this' context
# Usually you'd use classes for that (see below)









6. Classes & OOP






JavaScript (ES6+)






CODE
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}

greet() {
return `Hello, I'm ${this.name}`;
}

static species = "Human";
}

const alice = new Person("Alice", 30);









Python






CODE
class Person:
species = "Human" # Class attribute (static)

def __init__(self, name, age): # Constructor
self.name = name # Instance attribute
self.age = age

def greet(self): # Methods always have self parameter
return f"Hello, I'm {self.name}"

@staticmethod
def static_method():
return "This is static"

alice = Person("Alice", 30)
print(alice.greet()) # No parentheses needed for self when calling









7. Modules & Imports






JavaScript (ES6 Modules)






CODE
// math.js
export const PI = 3.14159;
export function add(a, b) { return a + b; }

// main.js
import { PI, add } from './math.js';
import * as math from './math.js';









Python






CODE
# math.py
PI = 3.14159
def add(a, b):
return a + b

# main.py
from math import PI, add
import math # Then use math.PI, math.add
import math as m # Alias









8. Error Handling






JavaScript






CODE
try {
throw new Error("Something went wrong");
} catch (error) {
console.error(error.message);
} finally {
console.log("Cleanup");
}









Python






CODE
try:
raise Exception("Something went wrong")
except Exception as e: # 'as' instead of variable declaration
print(f"Error: {e}")
finally:
print("Cleanup")









9. Async Programming






JavaScript (Promises/Async-Await)






CODE
// Promise
fetch('https://api.example.com/data')
.then(response => response.json())
.then(data => console.log(data));

// Async/await
async function getData() {
const response = await fetch(url);
return await response.json();
}









Python (Async/Await)






CODE
import asyncio
import aiohttp # External library for HTTP

async def fetch_data(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.json()

# Run async function
asyncio.run(fetch_data('https://api.example.com/data'))









10. Common Patterns & Tips






1. Type Checking (Python is dynamically typed but has type hints)






CODE
def add(a: int, b: int) -> int:  # Type hints (optional)
return a + b









2. String Formatting (multiple ways)






CODE
name = "Alice"
# f-strings (Python 3.6+, like template literals)
print(f"Hello {name}")

# .format() method
print("Hello {}".format(name))

# % formatting (older style)
print("Hello %s" % name)









3. Tuple vs List






CODE
# List - mutable
my_list = [1, 2, 3]
my_list[0] = 99 # OK

# Tuple - immutable
my_tuple = (1, 2, 3)
# my_tuple[0] = 99 # ERROR!









4. Sets (unique unordered collection)






CODE
my_set = {1, 2, 3, 3, 2}  # {1, 2, 3} (duplicates removed)
another_set = set([1, 2, 3, 4]) # Alternative creation









Quick Reference Table































































JavaScript Python Notes
let x = 5; x = 5 No declaration keywords
const arr = [] arr = [] No const, just assign

null / undefined
None Single null value

=== strict equality

== and is

== value, is identity
array.length len(list) Function, not property
array.map() List comprehensions [x*2 for x in arr]
for (let i=0; i<n; i++) for i in range(n) Different pattern
function fn() {} def fn():
def keyword
obj.property
dict["key"] or obj.attr
Depends on type
class MyClass {} class MyClass: Colon and indentation





Practice Exercise



Convert this JavaScript code to Python:




CODE
function filterEvenSquares(numbers) {
return numbers
.filter(n => n % 2 === 0)
.map(n => n ** 2);
}

const result = filterEvenSquares([1, 2, 3, 4, 5]);
console.log(result); // [4, 16]






Python solution:




CODE
def filter_even_squares(numbers):
return [n**2 for n in numbers if n % 2 == 0]

result = filter_even_squares([1, 2, 3, 4, 5])
print(result) # [4, 16]









Next Steps





  1. Install Python and a good IDE (VS Code with Python extension works well)


  2. Practice by rewriting your JS projects in Python


  3. Explore Python-specific features: decorators, generators, context managers


  4. Learn popular libraries:


    • Web: Flask/Django (Express equivalents)

    • Data: NumPy, Pandas

    • AI/ML: TensorFlow, PyTorch





The main mindset shift: Python emphasizes readability and simplicity over cleverness. You'll write less code to accomplish the same tasks!

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ 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
1 Quelle
KI-Angriffe: Geheimdienste sollen neue Befugnisse erhalten
1 Quelle
Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf
1 Quelle
PACMAN: KI-Framework steuert Fusionsplasma in Echtzeit
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Python Fundamentals for a JavaScript Developer

Thematisch verwandte Begriffe: Python, Fundamentals, JavaScript, Developer · 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 ...