Python
From Jon's Wiki
What is programming?
Starting with Python, we can:
- Get your computer to solve problems so you don't have to.
- Do data analysis, or maybe just add up a bunch of numbers.
- Write a video game.
- Manage your Open Stack clusters.
- Fetch your slippers, assuming your computer is controlling a robot.
Parts of a program
Here's a program:
from termcolor import colored total_eels = 10 eels_in_hovercraft = 0 print "My hovercraft is empty." while not raw_input("Throw in an eel (Y/N)? ").lower() == 'n': eels_in_hovercraft = eels_in_hovercraft + 1 if eels_in_hovercraft == total_eels: print "You have run out of eels!" break print "Eels in hovercraft: %s" % eels_in_hovercraft if eels_in_hovercraft > 5: print colored("My hovercraft is full of eels!", "green")
Tell the computer which bits of other people's code you want to use:
from termcolor import colored
Define some things that you want to use:
total_eels = 10
Get the computer to do things - e.g. print something to the screen:
print "My hovercraft is empty."
Control when and how often your code is executed:
while raw_input("Throw in an eel (Y/N)? ").lower() == 'y': ... if eels_in_hovercraft > 5: