$ python Python 3.9.9 | packaged by conda-forge | (main, Dec 20 2021, 02:38:53) [Clang 11.1.0 ] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> l = [34,12,15,9] >>> max(l) 34 >>> l.max() Traceback (most recent call last): File "", line 1, in AttributeError: 'list' object has no attribute 'max' >>> m = ['b','A',7,'!'] >>> max(m) Traceback (most recent call last): File "", line 1, in TypeError: '>' not supported between instances of 'int' and 'str' >>> l = [34,12,15,9] >>> sorted(l) [9, 12, 15, 34] >>> l [34, 12, 15, 9] >>> l2 = sorted(l) >>> l2 [9, 12, 15, 34] >>> l [34, 12, 15, 9] >>> sorted() >>> sorted(m) Traceback (most recent call last): File "", line 1, in TypeError: '<' not supported between instances of 'int' and 'str' >>> m ['b', 'A', 7, '!'] >>> m = ['b', 'A', '7', '!'] >>> sorted(m) ['!', '7', 'A', 'b'] >>> sorted(m, reverse=True) ['b', 'A', '7', '!'] >>> mm Traceback (most recent call last): File "", line 1, in NameError: name 'mm' is not defined >>> m ['b', 'A', '7', '!'] >>> range(10) range(0, 10) >>> list(range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> >>> for i in range(10): ... print(i) ... 0 1 2 3 4 5 6 7 8 9 >>> for i in range(10): ... print(i) ... 0 1 2 3 4 5 6 7 8 9 >>> >>> for i in range(10): ... print(i) File "", line 2 print(i) ^ IndentationError: expected an indented block >>> for i in range(3,10): ... print(i) ... 3 4 5 6 7 8 9 >>> for i in range(3,10,2): ... print(i) ... 3 5 7 9 >>> >>> for i in range(10,3,-1): ... print(i) ... 10 9 8 7 6 5 4 >>> >>> for i in range(3,10,0.5): ... print(i) ... Traceback (most recent call last): File "", line 1, in TypeError: 'float' object cannot be interpreted as an integer >>> for i in range(0.5,10): ... print(i) ... Traceback (most recent call last): File "", line 1, in TypeError: 'float' object cannot be interpreted as an integer >>> x = input() Tuesday >>> x 'Tuesday' >>> x = input() 0.03 >>> x '0.03' >>> x = float(input()) 0.03 >>> x 0.03 >>> x = float(input()) 99 >>> x 99.0 >>> >>> x = float(input()) Traceback (most recent call last): File "", line 1, in KeyboardInterrupt >>> x = int(input()) 99 >>> x 99 >>> x = int(input()) 0.03 Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '0.03' >>> $ (base) Desktop$ ls -l args.py \-rw-r--r--@ 1 sandiway staff 30 Jan 30 13:32 args.py (base) Desktop$ more args.py import sys print(sys.argv[0]) (base) Desktop$ python args.py 1 2 3 args.py (base) Desktop$ python args.py 1 2 3 2 (base) Desktop$ python args.py 100 7 Traceback (most recent call last): File "/Users/sandiway/Desktop/args.py", line 2, in print(sys.arg[1] + sys.argv[2]) AttributeError: module 'sys' has no attribute 'arg' (base) Desktop$ (base) Desktop$ python args.py 100 7 1007 (base) Desktop$ python args.py 100 7 107 (base) Desktop$ python args.py 30 9 40 99 7 ['30', '40', '7', '9', '99'] (base) Desktop$ python args.py 30 9 40 99 7 [7, 9, 30, 40, 99] (base) Desktop$