Friday, April 20, 2012

Hello World

I never write "hello world" programs.  I just installed Python (and Prolog) on my Linux based netbook.  Since any program can be built from sequences, loops, and decisions I tried Python out on:
a sequence of commands
a=2
b=3
c=a*b
print c

a simple loop
for x in range (0,4):
     print x

and a simple decision structure
a=5
b=3
if  a==5:
     print b
else:
     print a

With AI software I frequently try something like:
human(bob).
mortal(X):-human(X).
?-mortal(bob).

No comments:

Post a Comment