tools:python
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:python [2024/06/03 05:54] – [If] Humphrey Boa-Gart | tools:python [2024/10/01 02:43] (current) – AspHunter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{wst>iw-cleanup}} | + | {{wst>fix-stub}} |
====== Python ====== | ====== Python ====== | ||
- | Below applies to Python | + | //stub page for **Python |
- | Python is an object oriented, interpreted language. It is unique in that it requires a user to indent in place of using curly brackets ({..}). | ||
- | |||
- | Note: that most *nix distributions come with Python by default. | ||
- | |||
- | ===== Basics ===== | ||
- | |||
- | //Basic// python syntax | ||
- | |||
- | ==== Hello World! ==== | ||
- | |||
- | >>> | ||
- | HELLO WORLD! | ||
- | |||
- | ==== Variables ==== | ||
- | |||
- | Variable names DO NOT need to begin with a special character, unlike PHP. Variable names CAN, however, be any combination, | ||
- | |||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | [' | ||
- | >>> | ||
- | ' | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | 3.528 | ||
- | >>> | ||
- | 3 | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | <type ' | ||
- | >>> | ||
- | >>> | ||
- | <type ' | ||
- | >>> | ||
- | >>> | ||
- | | ||
- | ===== Statements ===== | ||
- | |||
- | ==== Comparison ==== | ||
- | |||
- | < Less than | ||
- | > | ||
- | == Equal to | ||
- | != Not equal | ||
- | is Identical | ||
- | is not Not identical | ||
- | <= Less than or equal to | ||
- | >= Greater than or equal to | ||
- | |||
- | === If === | ||
- | |||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | print " | ||
- | | ||
- | | ||
- | No! | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | print " | ||
- | |||
- | |||
- | Yes! | ||
- | >>> | ||
- | >>> | ||
- | >>> | ||
- | print " | ||
- | | ||
- | | ||
- | Yes! | ||
- | |||
- | ==== Loops ==== | ||
- | |||
- | === While === | ||
- | |||
- | >>> | ||
- | >>> | ||
- | print a | ||
- | a += 1; | ||
- | | ||
- | 1 | ||
- | 2 | ||
- | 3 | ||
- | 4 | ||
- | >>> | ||
- | >>> | ||
- | print " | ||
- | a = True; | ||
- | |||
- | |||
- | False | ||
- | |||
- | === For === | ||
- | |||
- | >>> | ||
- | print x | ||
- | | ||
- | |||
- | 0 | ||
- | 1 | ||
- | 2 | ||
- | 3 | ||
- | 4 | ||
- | 5 | ||
- | 6 | ||
- | 7 | ||
- | 8 | ||
- | 9 | ||
- | |||
- | //consider using xrange when dealing with larger lists, as it creates an iterator, rather than constructing the full list in memory// | ||
- | |||
- | >>> | ||
- | print x | ||
- | | ||
- | |||
- | Hello | ||
- | world | ||
- | ,this | ||
- | is | ||
- | a | ||
- | list | ||
{{tag> | {{tag> |
tools/python.1717394087.txt.gz · Last modified: 2024/08/06 05:52 (external edit)
Find this page online at: https://bestpoint.institute/tools/python
Find this page online at: https://bestpoint.institute/tools/python