Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> help(input) Help on built-in function input in module builtins: input(...) input([prompt]) -> string Read a string from standard input. The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError. On Unix, GNU readline is used if enabled. The prompt string, if given, is printed without a trailing newline before reading. >>> val = input("please enter something:") please enter something:19 >>> val '19' >>> type(val) >>> val = input("Please enter an integer: ") Please enter an integer: 53 >>> val '53' >>> math.log(1000, 10) Traceback (most recent call last): File "", line 1, in math.log(1000, 10) NameError: name 'math' is not defined >>> import math >>> math.log(1000, 10) 2.9999999999999996 >>> log(1000, 10) Traceback (most recent call last): File "", line 1, in log(1000, 10) NameError: name 'log' is not defined >>> from math import log >>> log(1000, 10) 2.9999999999999996 >>> 5/0 Traceback (most recent call last): File "", line 1, in 5/0 ZeroDivisionError: division by zero >>> ================================ RESTART ================================ >>> asdf qwerty Traceback (most recent call last): File "C:/Users/mil28/Desktop/example.py", line 8, in print(x) NameError: name 'x' is not defined >>> num = 2 >>> print("\tnum*1") print("\tnum*2") print("\tnum*3") SyntaxError: multiple statements found while compiling a single statement >>> print("\tnum*1") num*1 >>> print("\tnum*2") num*2 >>> print("\tnum*3") num*3 >>> print("\t"+str(num*2)) 4 >>> num = input("What is your favorite number? ") What is your favorite number? 2 >>> type(num) >>> ================================ RESTART ================================ >>> What is your favorite number? 2 The first three multiples of num are: 2 22 222 >>> 'asdf'*3 'asdfasdfasdf' >>> ================================ RESTART ================================ >>> What is your favorite number? 2 The first three multiples of num are: 2 4 6 >>> ================================ RESTART ================================ >>> What is your favorite number? 3.1 Traceback (most recent call last): File "C:/Users/mil28/Desktop/example.py", line 13, in num = int(num) ValueError: invalid literal for int() with base 10: '3.1' >>> ================================ RESTART ================================ >>> What is your favorite whole number? 3.1 Traceback (most recent call last): File "C:/Users/mil28/Desktop/example.py", line 13, in num = int(num) ValueError: invalid literal for int() with base 10: '3.1' >>> ================================ RESTART ================================ >>> What is your favorite number? 3.1 The first three multiples of num are: 3.1 6.2 9.3 >>> ================================ RESTART ================================ >>> What is your favorite number? two Traceback (most recent call last): File "C:/Users/mil28/Desktop/example.py", line 13, in num = float(num) ValueError: could not convert string to float: 'two' >>> ================================ RESTART ================================ >>> What is your favorite number? -2 The first three multiples of num are: -2.0 -4.0 -6.0 >>> ================================ RESTART ================================ >>> What is your favorite number? -3.1 The first three multiples of num are: -3.1 -6.2 -9.3 >>> ================================ RESTART ================================ >>> What is your favorite number? 3.1 The first three multiples of a are: 3.1 6.2 9.3 >>> ================================ RESTART ================================ >>> What is your favorite number? 2 The first three multiples of 2.0 are: 2.0 4.0 6.0 >>> print(3.1) 3.1 >>> print('asdf') asdf >>> ================================ RESTART ================================ >>> What is your favorite number? 2 Traceback (most recent call last): File "C:/Users/mil28/Desktop/example.py", line 14, in print("The first three multiples of"+a+"are: ") TypeError: Can't convert 'float' object to str implicitly >>> ================================ RESTART ================================ >>> What is your favorite number? 2 The first three multiples of2.0are: 2.0 4.0 6.0 >>> ================================ RESTART ================================ >>> What is your favorite number? 2 The first three multiples of 2.0 are: 2.0 4.0 6.0 >>> import sys >>> sys.exit() >>> ================================ RESTART ================================ >>> What is your favorite number? 2 >>> ================================ RESTART ================================ >>> What is your favorite number? 2 The first three multiples of 2.0 are: 2.0 4.0 6.0 >>> ================================ RESTART ================================ >>> What is your favorite number? 2 >>> ================================ RESTART ================================ >>> What is your favorite number? 2 >>> ================================ RESTART ================================ SyntaxError: invalid syntax >>> >>> 5.4/4.5 1.2000000000000002 >>> (5*5.4)/(5*4.5) 1.2 >>> abs(5.4/4.5 - (5*5.4)/(5*4.5)) < 1e-9 True >>> 5.4/4.5 == (5*5.4)/(5*4.5) False >>> '1000' >= '90' False >>> '1000' >= '10' True >>> 'cat' = 'Cat' SyntaxError: can't assign to literal >>> x = 'cat' >>> y = 'Cat' >>> x = y >>> x 'Cat' >>> y 'Cat' >>> 45 =< 1000 SyntaxError: invalid syntax >>> 45 <= 1000 True >>> x 'Cat' >>> x.startswith('C') True >>> x.startswith('a') False >>> x 'Cat' >>> x.startswith('c') False >>> True True >>> True and True True >>> True and False False >>> False and True False >>> x.startswith('C') and len(x) > 1 True >>> True or True True >>> True or False True >>> False or True True >>> False or False False >>> False and False False >>> option = input("Please enter your choice: ") Please enter your choice: 5 >>> option == '5' or option == '7' or option == '9' True >>> option == '5' or '7' or '9' True >>> option == '6' or '7' or '9' '7' >>> option == '6' or '8' '8' >>> >>> not True False >>> not False True >>> x = 'Cat' >>> x[0].isupper() True >>> x.isnotupper() Traceback (most recent call last): File "", line 1, in x.isnotupper() AttributeError: 'str' object has no attribute 'isnotupper' >>> not x.isupper() True >>> not x[0].isupper() False >>> x[0].islower() False >>> y = 9 >>> not y > 2 False >>> y <= 2 False >>> False and True or True True >>> False and False or True True >>> False or True True >>> x = 2 SyntaxError: unexpected indent >>> x = 2 >>> x = 2 SyntaxError: unexpected indent >>> if True: pass >>> if (True): print("This will print if condition is True") x = 5 This will print if condition is True >>> x 5 >>> a = True >>> b Traceback (most recent call last): File "", line 1, in b NameError: name 'b' is not defined >>> b Traceback (most recent call last): File "", line 1, in b NameError: name 'b' is not defined >>> if a: b = 5 >>> b 5 >>>