" " " This is my ongoing attempt to learn python with no previous programming experience whatsoever, Anyone may use it as they please. Documentation is notes to myself. Alex Jones 20/06/2006. " " "
" " " print = show things on screen " " "
print 'hello world'
" " " li = a list of things you might want to refer to " " "
li = ["eggs", "sausage", "beans", "chips"]
" " " print + li = prints something from list " " "
print li[0]
print li[3]
print li[-2]
print li[1:3]
" " " use a tuple ie. 't=' if you want a list but don't want to tamper with it. " " "
print "2 + 2 =", 2+2
" " " Use raw_input when you want words entered, and input for numbers " " "
print "Halt!"
s = raw_input("Who Goes there? ")
print "You may pass,", s
f = raw_input("What is your favourite food? ")
if f != li[0]:
print " Urgh I hate", f, "Why do you like that", s, "?"
else:
print s,"We're the same,", li[0], "are my favourite too!"
This is my first attempt at writing anything other than the most basic of html. I am very proud!
No comments:
Post a Comment