Python: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(47 intermediate revisions by the same user not shown)
Line 3: Line 3:


=Internal=
=Internal=
* [[Conda]]
* [[pip]]
* [[Julia]]
* [[Julia]]
* [[Jep]]
* [[Jep]]
* [[Go]]


=Subjects=
=Subjects=
* [[Python Language]]
** [[Python_Language_String#Overview|String]]
** [[Python_Language_List#Overview|List]], [[Python_Language_Dictionary#Overview|Dictionary]], [[Python_Language_Set#Overview|Set]]
** [[Python Language Functions#Overview|Functions]]
** [[Python_Language_Exceptions#Overview|Exceptions]]
** [[Python_Language_Modularization#Overview|Modularization]]
** [[Python_Language_OOP#Overview|Object Oriented Programming]]
* [[Python Engineering]]
* [[PyCharm]]
* [[Python on Kubernetes]]
* Simple Projects:
** [[PyCharm_Operations#Create_a_Simple.2C_Standalone_Project|With PyCharm]]
**  [[Python_Project_Layout#Setting_a_Manual_Project|Manual]]


* [[Python and IntelliJ IDEA#Overview|Python and IntelliJ IDEA]]
=Code Examples=
* [[Python Installation]]
{{Internal|Python Code Examples|Python Code Examples}}


=Organizatorium=
=Python Versions=
 
{{External|https://docs.python.org/3/whatsnew/}}
* https://opensource.com/article/18/1/running-python-application-kubernetes
* Each installation of Python may have different modules installed. Python determines the path to its modules by examining the location of the <code>python3</code> executable.
* Python environments on Mac:
** ~/Library/ApplicationSupport/iTerm2/iterm2env/versions/*/bin/python3
** ~/Library/ApplicationSupport/iTerm2/Scripts/YourScript/iterm2env/versions/*/bin/python3
 
====Basic Language====
Printing done with print() function.
<syntaxhighlight lang='py'>
print('something')
</syntaxhighlight>
Comments:
<syntaxhighlight lang='py'>
# This is a comment
</syntaxhighlight>
Variables.
<syntaxhighlight lang='py'>
a = 1
b = 'something'
print(a)
print(b)
</syntaxhighlight>
Functions:
<syntaxhighlight lang='py'>
def function_name(arguments):
  <function body>
 
def something(a, b):
  c = a + b
  return c
</syntaxhighlight>
 
Conditions:
<syntaxhighlight lang='py'>
if a == 1:
  print('something')
else:
  print('something else')
</syntaxhighlight>
 
Loops:
<syntaxhighlight lang='py'>
while <condition>:
  code-block
 
while x < 5:
  x = x + 1
  print
</syntaxhighlight>
 
String functions:
* Concatenate strings: <code>'a' + 'b'</code>
* Concatenate strings and integers: <code>'a' + str(1)</code>
 
<font color=darkgray>TODO. Continue: https://levelup.gitconnected.com/python-for-absolute-beginners-a-quick-primer-c7db94a5d0e</font>

Latest revision as of 21:12, 14 August 2023