Comments on writing Python on a MacBook
May 6, 2008# A hash denotes a single line comment in Python. # The hash key is very hard to find on a MacBook. # Because there isn't one. # Try Alt + 3
# A hash denotes a single line comment in Python. # The hash key is very hard to find on a MacBook. # Because there isn't one. # Try Alt + 3
So, I’ve been under some pressure from certain people to start learning Python. Sam is learning his multiplication tables at school so what better way to start than by killing two parrots with two sharp flat ones and a bag of gravel (after HelloWorld.py that is)…
# TimesTable
# For Sam - Prompts for a name and a number.
# Prints out x times table
# A bit Noddy but you gotta start somewhere...
name = raw_input( "Hello, what's your name : " )
print "Hi", name,
number = raw_input( ", type a number : " )
print " "
print "The times table for ", number, "is : "
print " "
for i in range(1, 13):
print i, "x", number, "=", i * int(number)