print ("Hello world") ___________________________________________ print ("Hello world", end="") ___________________________________________ python program.py ___________________________________________ #io example x = input("Enter a number") print x * x ___________________________________________ #if elfi else example x = input("enter a number") if x >= 90: print("A") elif x >= 80: print("B") elif x >= 70: print("C") elif x >= 60: print("D") else: print("F") ___________________________________________ print(x) i = 0 while i < 100: print i i = i + 1 ___________________________________________ #prints 0,9 for i in range(0,10): print i ___________________________________________ #command line example import sys for i in range(0,len(sys.argv)): print (sys.argv[i]) ___________________________________________ #File IO infile = open('bible.txt') outfile = open('out.txt', 'a') text = infile.read() print(text) outfile.write(text) infile.close() outfile.close() ___________________________________________ #function example def displayPunishment(n): for i in range(1,n): print("I will not talk in class") displayPunishment(500) ___________________________________________ def doesItChange(x): x = 9 def square(x): return x*x y = 1 doesItChange(y) print(y) ___________________________________________ import random random_number = random.randrange(1,101) guess = int(input("Guess the random number in the range 1-100: ")) while (guess != random_number): if (guess > random_number): print("Too high") else: print("Too low") guess = int(input("Guess the random number in the range 1-100: ")) print("Correct! The random number was ", random_number) ___________________________________________ z = 8 z = square(z) #tuple swap def swap(x,y): return (y,x) a = 1 b = 2 (a,b) = swap(a,b) (a,b) = (b,a) print(a) print(b) ___________________________________________ def sum(x,y): result = x + y return result z = sum(99,1) print z ___________________________________________