Zum Hauptinhalt springen
LIVE
CVSS 8.7CVE-2026-138099 | A vulnerability was identified in Tenda AC10U 1.18.6. Affected by this vulnerability is the function readUsb of the component ATE Service. Such manipulation leads to out-of-bounds write. The attack can be executed remotely. The exploit is publicly available and might be used.CVSS 6.9CVE-2026-138098 | A vulnerability was determined in weison-tech yii2-cms up to 1.0.2. Affected is an unknown function of the file protected/core/config/common.php of the component RBAC Authorization. This manipulation causes improper authorization. Remote exploitation of the attack is possible.CVSS 6.9CVE-2026-138097 | A vulnerability was found in weison-tech yii2-cms up to 1.0.2. This impacts the function isActive of the file AccessControl.php of the component RBAC Admin Module. The manipulation results in missing authorization. The attack may be launched remotely.CVSS 6.9CVE-2026-138096 | A vulnerability has been found in weison-tech yii2-cms up to 1.0.2. This affects an unknown function of the file protected/core/config/web.php of the component Admin Auto-Login Identity Cookie. The manipulation leads to improper authentication. The attack may be initiated remotely.CVSS 4.8CVE-2026-138094 | A security vulnerability has been detected in ggml-org llama.cpp up to 0.6.0. Impacted is the function ggml_acc_impl of the file ggml/src/ggml.c of the component ggml Handler. Such manipulation leads to numeric truncation error. The attack can only be performed from a local environment. Upgrading to version 0.7.0 is recommended to address this issue. The name of the patch is 8ae386707bed05f02354dbfc6fa5ee0cf58e5f0f. It is recommended to upgrade the affectedCVSS 6.9CVE-2026-138093 | A weakness has been identified in alexander-torosh yona-cms up to 0.5.0. This issue affects the function loginAction of the file app/modules/Admin/Controller/IndexController.php of the component Admin Login Endpoint. This manipulation causes sql injection. It is possible to initiate the attack remotely.CVSS 4.8CVE-2026-138092 | A security flaw has been discovered in ggml-org llama.cpp up to 0.8.0. This vulnerability affects the function ggml_roll of the file ggml/src/ggml.c of the component Ggml Tensor Library Roll Operation. The manipulation results in integer overflow. The attack needs to be approached locally. Upgrading to version 0.9.0 is able to resolve this issue. The patch is identified as 0978a6e9022fb9bd6874b86154ee304e81929b9f. It is suggested to upgrade the affected compCVSS 10.0CVE-2026-138091 | A vulnerability was identified in Tenda AC10U 15.03.06.48. This affects the function TendaTelnet of the file /goform/telnet of the component Web UI. The manipulation leads to missing authentication. The attack is possible to be carried out remotely. The exploit is publicly available and might be used.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

Python for Beginners — Part 5: Collections

Part 5 of a beginner-friendly series on learning Python from scratch. In Part 4, we learned how to make decisions and repeat code with loops. Now we're going…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 7 Min. Lesezeit
Quelle: dev.to
Rubrik: Programmazione sicura

Part 5 of a beginner-friendly series on learning Python from scratch.



In Part 4, we learned how to make decisions and repeat code with loops. Now we're going to upgrade that power dramatically: instead of working with single values, we'll work with entire collections of data.



This is where Python becomes truly versatile. Collections let you store multiple values in a single variable, organize data logically, and iterate over it with the loops you just learned. Most real programs spend their time managing collections.






Lists — Ordered, Changeable Collections



A list is a container that holds multiple values in a specific order. You can add, remove, or change items after creating the list.






Creating and accessing lists






fruits = ["apple", "banana", "cherry"]
numbers = [1, 2, 3, 4, 5]
mixed = [1, "hello", 3.14, True]






Lists use square brackets and items are separated by commas. Items can be different types.



Access items by their index (position), just like strings:




fruits = ["apple", "banana", "cherry"]
print(fruits[0]) # apple
print(fruits[1]) # banana
print(fruits[-1]) # cherry (last item)






Get the length with len():




print(len(fruits))  # 3









Slicing lists



Just like strings, lists can be sliced:




numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(numbers[0:3]) # [1, 2, 3]
print(numbers[5:]) # [6, 7, 8, 9, 10]
print(numbers[::2]) # [1, 3, 5, 7, 9] (every 2nd item)









Essential list methods



Lists come with many built-in methods. Here are the most important:




fruits = ["apple", "banana"]

# Add items
fruits.append("cherry") # Add to the end
fruits.insert(1, "mango") # Insert at specific position
fruits.extend(["date", "elderberry"]) # Add multiple items

# Remove items
fruits.remove("banana") # Remove by value
fruits.pop() # Remove last item and return it
fruits.pop(0) # Remove item at index 0
fruits.clear() # Remove all items

# Find and sort
numbers = [3, 1, 4, 1, 5, 9, 2, 6]
print(numbers.count(1)) # 2 (how many 1's)
print(numbers.index(4)) # 2 (position of 4)
numbers.sort() # Sort in place: [1, 1, 2, 3, 4, 5, 6, 9]
numbers.reverse() # Reverse in place

# Create a copy
numbers_copy = numbers.copy() # Independent copy






Important: sort() and reverse() change the list itself, not creating a new list. If you want to keep the original:




sorted_numbers = sorted(numbers)     # Returns a new sorted list









Modifying list items



Lists are mutable (changeable):




fruits = ["apple", "banana", "cherry"]
fruits[1] = "blueberry" # Change the second item
print(fruits) # ["apple", "blueberry", "cherry"]









Iterating over lists



Combine lists with the for loops from Part 4:




fruits = ["apple", "banana", "cherry"]

for fruit in fruits:
print(fruit)






Output:




apple
banana
cherry









List comprehension — concise list creation



List comprehension is a compact way to create a new list by transforming or filtering an existing one:




# Create a list of squares
numbers = [1, 2, 3, 4, 5]
squares = [x**2 for x in numbers]
print(squares) # [1, 4, 9, 16, 25]

# Filter: only even numbers
evens = [x for x in numbers if x % 2 == 0]
print(evens) # [2, 4]

# Transform and filter
result = [x * 2 for x in numbers if x > 2]
print(result) # [6, 8, 10]






Read it as: "Create a list of [transformation] for [each item] in [source list] if [condition]"



List comprehensions are faster and more Pythonic than building lists with loops. They're common in real code.






Tuples — Ordered, Unchangeable Collections



A tuple is like a list, but immutable (unchangeable). Once created, you can't add, remove, or modify items.






Creating tuples






colors = ("red", "green", "blue")
single_item = ("hello",) # Note the comma — without it, it's just a string
empty = ()






Use parentheses (round brackets). The comma is crucial for single-item tuples.






Accessing and iterating






colors = ("red", "green", "blue")
print(colors[0]) # red
print(colors[-1]) # blue
print(len(colors)) # 3

for color in colors:
print(color)









Unpacking tuples



Tuples shine when you want to assign multiple values at once:




x, y = (1, 2)
print(x) # 1
print(y) # 2

# The parentheses are optional
name, age, city = "Ramesh", 25, "Chennai"
print(name, age, city) # Ramesh 25 Chennai

# Swap variables easily
a, b = 1, 2
a, b = b, a # Now a=2, b=1









Why use tuples?





  • Speed: Slightly faster than lists (minor difference)


  • Safety: Immutable, can't accidentally modify


  • Keys in dictionaries: Tuples can be dict keys; lists can't


  • Function returns: Functions often return tuples of multiple values




def get_user():
return ("Ramesh", 25, "Chennai")

name, age, city = get_user()









Sets — Unique, Unordered Collections



A set is a collection of unique values with no specific order. Duplicates are automatically removed.






Creating sets






numbers = {1, 2, 3, 4, 5}
unique_letters = {"a", "b", "c", "a"} # 'a' appears once
print(unique_letters) # {'a', 'b', 'c'} (order may vary)

empty_set = set() # Note: {} creates an empty dict, not a set






Use curly braces. Sets have no indexing — you can't access the first item like you can with lists.






Common set operations






a = {1, 2, 3}
b = {3, 4, 5}

# Union — all items from both sets
print(a | b) # {1, 2, 3, 4, 5}
print(a.union(b)) # {1, 2, 3, 4, 5}

# Intersection — items in both sets
print(a & b) # {3}
print(a.intersection(b)) # {3}

# Difference — items in a but not b
print(a - b) # {1, 2}
print(a.difference(b)) # {1, 2}

# Check membership
print(3 in a) # True
print(4 in a) # False









Set methods






numbers = {1, 2, 3}
numbers.add(4) # Add one item
numbers.update([5, 6]) # Add multiple items
numbers.remove(2) # Remove item (error if not found)
numbers.discard(10) # Remove item (no error if not found)
numbers.clear() # Remove all items









Use cases for sets





  • Remove duplicates: unique = set([1, 2, 2, 3, 3, 3]) → {1, 2, 3}


  • Check membership: Sets are faster than lists for in checks


  • Mathematical operations: Union, intersection, difference






Dictionaries — Key-Value Pairs



A dictionary stores pairs of keys and values. You access values using their keys, not positions.






Creating dictionaries






person = {
"name": "Ramesh",
"age": 25,
"city": "Chennai"
}

scores = {"math": 95, "science": 87, "history": 92}
empty = {}






Use curly braces with key: value pairs. Keys are usually strings; values can be any type.






Accessing and modifying






person = {"name": "Ramesh", "age": 25}

print(person["name"]) # Ramesh
print(person["age"]) # 25

# Modify existing key
person["age"] = 26

# Add new key
person["city"] = "Chennai"

# Try to access non-existent key (safer way)
person.get("phone") # None (no error)
person.get("phone", "N/A") # N/A (default value)









Dictionary methods






person = {"name": "Ramesh", "age": 25, "city": "Chennai"}

# Get all keys, values, or pairs
print(person.keys()) # dict_keys(['name', 'age', 'city'])
print(person.values()) # dict_values(['Ramesh', 25, 'Chennai'])
print(person.items()) # dict_items([('name', 'Ramesh'), ('age', 25), ...])

# Iterate
for key in person:
print(f"{key}: {person[key]}")

# Iterate over pairs
for key, value in person.items():
print(f"{key}: {value}")

# Remove items
person.pop("age") # Remove and return value
person.popitem() # Remove last pair
person.clear() # Remove all

# Update from another dict
person.update({"phone": "555-1234", "age": 26})









Nested dictionaries



Dictionaries can contain other dictionaries (or lists, or tuples):




team = {
"player1": {"name": "Ramesh", "score": 95},
"player2": {"name": "Priya", "score": 87},
"player3": {"name": "Arun", "score": 92}
}

print(team["player1"]["name"]) # Ramesh
print(team["player2"]["score"]) # 87









Choosing the Right Collection











































Collection Ordered Changeable Duplicates Use Case
List ✓ ✓ ✓ Store sequence of items
Tuple ✓ ✗ ✓ Immutable sequences, dict keys
Set ✗ ✓ ✗ Unique values, membership checks
Dict ✓ (Python 3.7+) ✓ ✓ (values) Store labeled data, key-value lookup





Practical Examples






Example 1: Managing a to-do list






todos = []

# Add tasks
todos.append("Buy groceries")
todos.append("Finish project")
todos.append("Call mom")

# Mark as done (remove)
todos.remove("Buy groceries")

# Show remaining
for i, task in enumerate(todos):
print(f"{i+1}. {task}")






Output:




1. Finish project
2. Call mom









Example 2: Count word frequency






text = "the quick brown fox jumps over the lazy dog the fox"
words = text.split()
word_count = {}

for word in words:
if word in word_count:
word_count[word] += 1
else:
word_count[word] = 1

print(word_count)
# {'the': 3, 'quick': 1, 'brown': 1, 'fox': 2, ...}






Or more concisely:




from collections import Counter
word_count = Counter(words)
print(word_count)









Example 3: Find common interests






alice_interests = {"python", "music", "hiking", "gaming"}
bob_interests = {"python", "gaming", "cooking", "music"}

# What do they both enjoy?
common = alice_interests & bob_interests
print(common) # {'python', 'gaming', 'music'}

# What does Alice enjoy that Bob doesn't?
alice_unique = alice_interests - bob_interests
print(alice_unique) # {'hiking'}









Why This Matters



Collections are fundamental to every real program. You'll spend most of your programming time manipulating lists, dictionaries, and sets. Once you internalize which tool is right for each job, you'll write cleaner, faster code.



The most common beginner mistakes:




  • Confusing list and tuple syntax ([] vs ())

  • Trying to add items to a tuple (they're immutable!)

  • Using {} for an empty set and getting a dict instead

  • Trying to use lists as dictionary keys (they're unhashable)

  • Forgetting that dictionaries store by key, not position






This is Part 5 of an 8-part beginner Python series. Catch up on Part 1: Getting Started & Syntax, Part 2: Variables, Data Types & Numbers, Part 3: Strings & Booleans, and Part 4: Operators & Control Flow.

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Discussione della community e commenti

🌐 Entra nella chat principale

Avvia la discussione nel flusso broadcast della Social Chat oppure invia qui sopra un contributo esperto tramite il modulo di integrazione.

Valutazione della community & prova sociale
⭐ Giudizio dei lettori
–
Ø / 5.0
Ancora nessuna valutazione dei lettori
Questo articolo ti è stato utile?
0
Lascia ora la tua valutazione
Valutazione dettagliata (facoltativa)
Contenuto & qualità
Fonte & credibilità
Attualità
Briefing di sicurezza Gratuito · disdetta in 1 clic

Intelligence Digest — gratuito

Ogni giorno le notizie di sicurezza più importanti · annullabile in qualsiasi momento

Cluster di storie correlate & fonti (IA vettoriale)

6 Cluster
23 fonti
CVE-2026-72239 | Linux Kernel sev x86/virt/sev/sev.c wbinvd_on_all_cpus state issue (WID-SEC-2026-2852)
VulDB Updates 33 min. fa
22 altre fonti
VulDB Updates33 min. faCVE-2026-72240 | Linux Kernel up to 7.1.4 mfd sm501_register_device memory leak (WID-SEC-2026-2852) VulDB Updates33 min. faCVE-2026-72241 | Linux Kernel up to 7.1.4 uleds strchr buffer overflow (WID-SEC-2026-2852) VulDB Updates33 min. faCVE-2026-72244 | Linux Kernel up to 6.12.100/6.18.41/7.1.4/7.2-rc2 gpu-buddy allocation of resources (WID-SEC-2026-2852) VulDB Updates33 min. faCVE-2026-72243 | Linux Kernel up to 7.2-rc2 selinux socket_sendmsg permission (Nessus ID 364200 / WID-SEC-2026-2852) VulDB Updates33 min. faCVE-2026-72245 | Linux Kernel up to 7.1.4 host1x host1x_device_parse_dt release of resource (WID-SEC-2026-2852) VulDB Updates33 min. faCVE-2026-72246 | Linux Kernel flowtable input validation (WID-SEC-2026-2852) VulDB Updates33 min. faCVE-2026-72247 | Linux Kernel up to 7.2-rc3 nf_conncount __nf_conncount_add dir comparison (WID-SEC-2026-2852) VulDB Updates33 min. faCVE-2026-72248 | Linux Kernel up to 7.1.4/7.2-rc2 flowtable nft_flow_dst_release buffer overflow (WID-SEC-2026-2852) LinuxAndUbuntu51 min. faLinux AutoFDO Benchmark: Clang Kernel Optimization VulDB Updates1 h faCVE-2022-31607 | NVIDIA GPU Display Driver on Linux Kernel Mode Layer nvidia.ko input validation (EUVD-2022-53059 / Nessus ID 339047) VulDB Updates2 h faCVE-2026-72227 | Linux Kernel up to 6.12.96/6.18.39/7.1.4/7.2-rc2 batman-adv out-of-bounds (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72228 | Linux Kernel up to 7.2-rc2 batman-adv skb_split memory leak (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72229 | Linux Kernel up to 7.2-rc2 batman-adv register_netdevice memory leak (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72231 | Linux Kernel up to 7.2-rc2 batman-adv batadv_send_tt_request allocation of resources (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72230 | Linux Kernel up to 7.2-rc2 batman-adv batadv_frag_send_packet memory leak (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72232 | Linux Kernel up to 7.2-rc2 batman-adv batadv_interface_tx out-of-bounds (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72234 | Linux Kernel up to 7.2-rc1 batman-adv batadv_get_vid use after free (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72233 | Linux Kernel up to 7.2-rc1 batman-adv batadv_bla_is_backbone_gw use after free (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72236 | Linux Kernel up to 7.2-rc3 s390/perf_cpum_cf __hw_perf_event_init config array index (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72235 | Linux Kernel up to 7.2-rc1 batman-adv batadv_interface_rx use after free (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72237 | Linux Kernel up to 7.2-rc2 BRS /x86/amd/brs amd_brs_match_plm information disclosure (WID-SEC-2026-2852) VulDB Updates2 h faCVE-2026-72238 | Linux Kernel up to 7.2-rc3 x86 boot early_serial_init integer overflow (WID-SEC-2026-2852)
13 fonti
Cyber Monday Meta Quest 3S Deal Knocks $53 Off and Gets You $50 Free Amazon Credit
CNET 13 min. fa
12 altre fonti
Articoli simili
🔍 Verwandte News

Auch interessante Nachrichten Python for Beginners — Part 5: Collections

Thematisch verwandte Begriffe: Python, Beginners, Part, Collections · 6 Treffer

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

Laden...

Caricamento degli articoli ...

Laden...

Caricamento dei video ...

💬 Caricamento dei commenti…
Trascina per aggiornare
Widget & argomenti
Caricamento widget…
Articolo successivo