python

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
python [2017/05/05 02:43] – [Basic Structures and Constructs] mguptonpython [2023/03/20 17:33] (current) – [Python] mgupton
Line 1: Line 1:
 ======Python====== ======Python======
 +  * [[https://www.python.org/dev/peps/pep-0008/|PEP 8 -- Style Guide for Python Code]]
 +  * [[https://pep8.org/]]
 +
 +  * [[Python Modules and Packages]]
 +  * [[Python Tools]]
 +  * [[python:Handling Dates]]
 +
 +
 ======Core Elements & Constructs====== ======Core Elements & Constructs======
 =====Lists===== =====Lists=====
Line 41: Line 49:
    b    b
 => {} => {}
-</code> 
- 
-=====Iterate over keys and values of dictionary==== 
-<code python> 
-for k, v in dict.items(): 
-    print(v) 
-</code> 
- 
-<code python> 
-for k in dict.keys(): 
-    print(k + "\n") 
-</code> 
-<code python> 
-for v in dict.values(): 
-    print(v + "\n") 
 </code> </code>
  
Line 82: Line 75:
 else: else:
     pass     pass
 +</code>
 +
 +======Loops/Iteration======
 +<code python>
 +colors = ["red", "green", "blue"]
 +
 +for c in colors:
 +    print("%s" % c)
 +</code>
 +
 +=====Iterate over keys and values of dictionary====
 +<code python>
 +for k, v in dict.items():
 +    print(v)
 +</code>
 +
 +<code python>
 +for k in dict.keys():
 +    print(k + "\n")
 +</code>
 +<code python>
 +for v in dict.values():
 +    print(v + "\n")
 +</code>
 +
 +=====Iterate over indicies and values of sequence=====
 +<code python>
 +a = ["a", "b", "c"]
 +
 +for k, v in enumerate(a):
 +
 +    print("%s, %s\n" % (k,v))
 </code> </code>
  
Line 116: Line 141:
 </code> </code>
  
 +=======Resources/References======
 +  * [[http://docs.python-guide.org/en/latest/|The Hitchhiker’s Guide to Python]]
 +  * [[https://realpython.com/|Real Python]], tutorials and other learning resources
  
  • python.1493952187.txt.gz
  • Last modified: 2017/05/05 02:43
  • by mgupton