"""An example of getting input from the user and doing basic numerical and looping operations. Companion to FirstDayDemo.java.""" def main(): """Get a number interactively and tell the user about it.""" # Ask for a number, and interpret the user's response as an int. num = int(raw_input("Enter a number: ")) # Now the user's input is stored in the variable num; # let's tell them about it. print "The number you entered was:", num # Check whether it is even or odd. if num % 2 == 0: print "Your number is even." else: print "Your number is odd." # Print "hello" for as many times as the user entered. for i in range(num): print "Hello!" if __name__ == "__main__": main()