#!/usr/bin/python

hello = "Hello world"
print hello

# While loop:
#--------------
print "\n while \n ---------"
x=1
while x<10:
    print x
    x=x+1

# If statement:
#--------------
print "\n if \n ---------"
if x<10:
    print x," is smaller than 10"
else:
    print x," is not smaller than 10"

# Or:
#--------------
print "\n or \n ---------"
y=10*x
if x<10 or y>10:
    print y," is bigger than 10?"

# Output
#-------------
print "\n Write file \n ---------"
outfilename = "out.dat"
outfile = open( outfilename, "w")
print >> outfile,y
outfile.close()

# Input
#-------------
print "\n Read file \n ---------"
infilename = "out.dat"
infile = open( infilename, "r")
for line in infile:
    tkst=int( line )
    print "first line contains:",tkst
infile.close()
