User Tools

Site Tools


python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python [2022/09/12 00:30] – external edit 127.0.0.1python [2022/12/05 16:26] (current) utedass
Line 30: Line 30:
 populated_tuple = (1, 2, "Kalle", 4.32) populated_tuple = (1, 2, "Kalle", 4.32)
 singleton_tuple = (3,) singleton_tuple = (3,)
 +print(populated_tuple[2]) # Prints Kalle
  
 # Ranges are also immutable # Ranges are also immutable
Line 57: Line 58:
 all_keys = list(my_dict) all_keys = list(my_dict)
 leet = my_dict['shit'] leet = my_dict['shit']
 +
 +# Dictionaries can be unpacked and used as arguments to a function
 +dude = {a: 4, b: 5}
 +function_that_takes_a_and_b(**dude)
  
 # Set types must contain hashable objects. They are not ordered and cannot be indexed # Set types must contain hashable objects. They are not ordered and cannot be indexed
Line 99: Line 104:
  
  
-====== Parser ======+====== Argument parser ======
  
 <code python> <code python>
python.1662942654.txt.gz · Last modified: 2022/09/12 00:30 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki