Python: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
Line 52: Line 52:
You can insert Python code in a wiki page with syntax highlighting in this way:
You can insert Python code in a wiki page with syntax highlighting in this way:


  <nowiki><source lang="python"></source></nowiki>
  <nowiki><syntaxhighlight lang="python"></syntaxhighlight></nowiki>


So for example:
So for example:


  <nowiki><source lang="python">
  <nowiki><syntaxhighlight lang="python">
  print("Enter your name:")
  print("Enter your name:")
  x = input() # waiting for input
  x = input() # waiting for input
  print("Hello, " + x)
  print("Hello, " + x)
  </source></nowiki>
  </syntaxhighlight></nowiki>


renders as:
renders as:


<source lang="python">
<syntaxhighlight lang="python">
print("Enter your name:")
print("Enter your name:")
x = input() # waiting for input
x = input() # waiting for input
print("Hello, " + x)
print("Hello, " + x)
</source>
</syntaxhighlight>


[[Category:Python]]
[[Category:Python]]

Revision as of 12:25, 29 September 2025

python.png

Python is a scripting language written by Guido van Rossom.

The name actually refers to Monty Python, the charmingly irreverent and absurdist comedy troupe, as opposed to venomous snake.

General

  • Charming Pythonistas, an article about why Python makes a good learning language, and in particular considers the underrepresentation of female programmers

Learning Python

Has been used in the course as a textbook

A nice quick intro to programming with Python as the specific language.

Another good, free, resource, by Mark Pilgrim

Interesting discussion about the merits of Python as a learning language, and the "gender gap" in programming

  • A Python "Cheat Sheet" -- hmmm, might it not be a good project to be able to generate your own "cheat sheets"?

Useful Add-ons (Libraries)

Applications that use/support Python plugins/extensions

Visualisations of python code

Saving Python code in the wiki

You can insert Python code in a wiki page with syntax highlighting in this way:

<syntaxhighlight lang="python"></syntaxhighlight>

So for example:

<syntaxhighlight lang="python">
 print("Enter your name:")
 x = input() # waiting for input
 print("Hello, " + x)
 </syntaxhighlight>

renders as:

print("Enter your name:")
x = input() # waiting for input
print("Hello, " + x)