slabbe@labbe-laptop ~ $ python Python 2.7.18 (default, Aug 4 2020, 11:16:42) [GCC 9.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> slabbe@labbe-laptop ~ $ python python python3.8 python3-pasteurize python2 python3.8-config pythontex python2.7 python3-config python3 python3-futurize slabbe@labbe-laptop ~ $ python3 Python 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> >>> >>> >>> help Type help() for interactive help, or help(object) for help about object. >>> >>> >>> help() Welcome to Python 3.8's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/3.8/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". help> keywords Here is a list of the Python keywords. Enter any keyword to get more help. False class from or None continue global pass True def if raise and del import return as elif in try assert else is while async except lambda with await finally nonlocal yield break for not help> False help> if help> You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" has the same effect as typing a particular string at the help> prompt. >>> help() Welcome to Python 3.8's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/3.8/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". help> modules Please wait a moment while I gather a list of all available modules... AptUrl apt_pkg html requests CommandNotFound aptdaemon http requests_unixsocket DistUpgrade aptsources httplib2 resource HweSupportStatus argparse idlelib rlcompleter LanguageSelector array idna roman NvidiaDetector arxiv_collector imaplib rst2pdf Onboard ast imghdr rubber PIL asynchat imp runpy PyQt5 asyncio importlib scanext Quirks asyncore inspect sched UbuntuDrivers atexit io secrets UnityTweakTool audioop ipaddress secretstorage UpdateManager base64 itertools select Xlib bcrypt janitor selectors __future__ bdb jinja2 setproctitle _abc binascii json setuptools _ast binhex jwt shelve _asyncio bisect keyring shlex _bisect blinker keyword shutil _blake2 blueman language_support_pkgs signal _blueman borg launchpadlib simplejson _bootlocale breezy lib2to3 sip _bz2 brlapi libfuturize sipconfig _cffi_backend builtins libpasteurize sipconfig_nd8 _codecs bz2 linecache site _codecs_cn cProfile llfuse sitecustomize _codecs_hk cairo locale six _codecs_iso2022 calendar lockfile smartypants _codecs_jp certifi logging smtpd _codecs_kr cgi louis smtplib _codecs_tw cgitb lsb_release sndhdr _collections chardet lzma socket _collections_abc chunk macaroonbakery socketserver _compat_pickle click mailbox softwareproperties _compression cmath mailcap speechd _contextvars cmd mako speechd_config _crypt code markupsafe spwd _csv codecs marshal sqlite3 _ctypes codeop math sre_compile _ctypes_test collections mimetypes sre_constants _curses colorama mmap sre_parse _curses_panel colorsys modulefinder ssl _datetime compileall monotonic stat _dbm concurrent mps_youtube statistics _dbus_bindings configobj msgpack string _dbus_glib_bindings configparser multiprocessing stringprep _decimal contextlib nacl struct _dummy_thread contextvars neovim subprocess _elementtree copy netifaces sunau _functools copyreg netrc symbol _gdbm crypt nis symtable _hashlib cryptography nntplib sys _heapq csv ntpath sysconfig _imp ctypes nturl2path syslog _io cups numbers systemd _json cupsext numpy tabnanny _locale cupshelpers oauthlib talloc _lsprof curses olefile tarfile _lzma dataclasses opcode telnetlib _markupbase datetime operator tempfile _md5 dateutil optparse termios _multibytecodec dbm orca test _multiprocessing dbus os textwrap _opcode deb822 ossaudiodev this _operator debconf pafy threading _osx_support debian pam time _pickle debian_bundle paramiko timeit _posixshmem decimal parser tinycss _posixsubprocess decorator past tkinter _py_abc defer pathlib token _pydecimal deprecated pcardext tokenize _pyio difflib pdb trace _queue dis pdfrw traceback _random distro pexpect tracemalloc _sha1 distro_info pickle tty _sha256 distutils pickletools turtle _sha3 doctest pip types _sha512 docutils pipes typing _signal dulwich pkg_resources uaclient _sitebuiltins dummy_threading pkgutil ufw _socket duplicity platform unicodedata _sqlite3 easy_install plistlib unittest _sre email poplib uno _ssl encodings posix unohelper _stat entrypoints posixpath urllib _statistics enum pprint urllib3 _string errno problem_report usbcreator _strptime fail2ban profile uu _struct fasteners pstats uuid _symtable fastimport psutil validate _sysconfigdata__linux_x86_64-linux-gnu faulthandler pty venv _sysconfigdata__x86_64-linux-gnu fcntl ptyprocess wadllib _testbuffer filecmp pwd warnings _testcapi fileinput py_compile wave _testimportmultiple fnmatch pyatspi weakref _testinternalcapi formatter pyclbr webbrowser _testmultiphase fractions pydoc wheel _thread ftplib pydoc_data wrapt _threading_local functools pyexpat wsgiref _tkinter future pyflakes xapp _tracemalloc gc pygments xattr _uuid genericpath pygtkcompat xdg _version getopt pyinotify xdiagnose _warnings getpass pymacaroons xdrlib _weakref gettext pynvim xkit _weakrefset gi pyopencl xml _xxsubinterpreters github pyrfc3339 xmlrpc _xxtestfuzz gitlab pytools xxlimited _yaml glob pytz xxsubtype abc gpg queue yaml aifc greenlet quopri yo antigravity grp random youtube_dl appdirs gzip ratpoison zipapp apport hashlib re zipfile apport_python_hook heapq readline zipimport apt hmac reportlab zlib apt_inst hpmudext reprlib Enter any module name to get more help. Or, type "modules spam" to search for modules whose name or summary contain the string "spam". help> modules csv Here is a list of modules whose name or summary contains 'csv'. If there are any, enter a module name to get more help. _csv - CSV parsing and writing. csv - csv.py - read/write/investigate CSV files help> You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" has the same effect as typing a particular string at the help> prompt. >>> >>> help() Welcome to Python 3.8's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/3.8/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". help> symbols Here is a list of the punctuation symbols which Python assigns special meaning to. Enter any symbol to get more help. != + <= __ " += <> ` """ , == b" % - > b' %= -= >= f" & . >> f' &= ... >>= j ' / @ r" ''' // J r' ( //= [ u" ) /= \ u' * : ] | ** < ^ |= **= << ^= ~ *= <<= _ help> topics Here is a list of available topics. Enter any topic name to get more help. ASSERTION DELETION LOOPING SHIFTING ASSIGNMENT DICTIONARIES MAPPINGMETHODS SLICINGS ATTRIBUTEMETHODS DICTIONARYLITERALS MAPPINGS SPECIALATTRIBUTES ATTRIBUTES DYNAMICFEATURES METHODS SPECIALIDENTIFIERS AUGMENTEDASSIGNMENT ELLIPSIS MODULES SPECIALMETHODS BASICMETHODS EXCEPTIONS NAMESPACES STRINGMETHODS BINARY EXECUTION NONE STRINGS BITWISE EXPRESSIONS NUMBERMETHODS SUBSCRIPTS BOOLEAN FLOAT NUMBERS TRACEBACKS CALLABLEMETHODS FORMATTING OBJECTS TRUTHVALUE CALLS FRAMEOBJECTS OPERATORS TUPLELITERALS CLASSES FRAMES PACKAGES TUPLES CODEOBJECTS FUNCTIONS POWER TYPEOBJECTS COMPARISON IDENTIFIERS PRECEDENCE TYPES COMPLEX IMPORTING PRIVATENAMES UNARY CONDITIONAL INTEGER RETURNING UNICODE CONTEXTMANAGERS LISTLITERALS SCOPING CONVERSIONS LISTS SEQUENCEMETHODS DEBUGGING LITERALS SEQUENCES help> IDENTIFIERS help> You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" has the same effect as typing a particular string at the help> prompt. >>> >>> >>> >>> >>> >>> >>> 3 + 8 11 >>> >>> >>> 4 + 6 10 >>> >>> >>> >>> 4 * 6 24 >>> >>> >>> 4 - 6 -2 >>> >>> >>> 4 / 6 0.6666666666666666 >>> >>> >>> >>> type(4) >>> >>> >>> type(4.0) >>> >>> >>> >>> '4' '4' >>> >>> print('4') 4 >>> 4 4 >>> print(4) 4 >>> print('4') 4 >>> >>> type(4) >>> >>> >>> >>> 20 // 6 3 >>> >>> >>> 20 % 6 2 >>> >>> >>> >>> >>> 4 ** 2 16 >>> >>> 4 ^ 2 6 >>> >>> >>> >>> from math import sqrt >>> >>> sqrt(5) 2.23606797749979 >>> sqrt(4) 2.0 >>> >>> >>> >>> >>> help(math) Traceback (most recent call last): File "", line 1, in NameError: name 'math' is not defined >>> import math >>> help(math) >>> from math import pi >>> >>> >>> pi 3.141592653589793 >>> >>> >>> >>> >>> x = 45 >>> >>> >>> >>> x 45 >>> >>> >>> x + 10 55 >>> >>> >>> print(x) 45 >>> >>> >>> x 45 >>> >>> >>> x = x + 1 >>> >>> x 46 >>> >>> x += 1 >>> >>> x 47 >>> >>> >>> x1 = 34 >>> >>> x1 34 >>> >>> >>> 1x = 34 File "", line 1 1x = 34 ^ SyntaxError: invalid syntax >>> >>> >>> x2 = 3553 >>> x2 3553 >>> >>> >>> x = 343 >>> type(x) >>> >>> >>> y = 343.8 >>> type(y) >>> >>> >>> float(x) 343.0 >>> int(y) 343 >>> y 343.8 >>> >>> str(141324) '141324' >>> >>> int('141324') 141324 >>> int('141324asdfa') Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '141324asdfa' >>> >>> >>> >>> 4 < 5 True >>> reponse = 4 < 5 >>> reponse True >>> type(reponse) >>> >>> >>> >>> >>> >>> >>> 'asdfadsf' 'asdfadsf' >>> >>> >>> 'sebastien' 'sebastien' >>> >>> >>> s = 'sebastien' >>> >>> >>> s = 'aujourd'hui' File "", line 1 s = 'aujourd'hui' ^ SyntaxError: invalid syntax >>> >>> >>> s = 'aujourd'hui" File "", line 1 s = 'aujourd'hui" ^ SyntaxError: invalid syntax >>> s = "aujourd'hui" >>> >>> >>> s "aujourd'hui" >>> s = 'aujourd"hui' >>> s = 'aujo'urd"hui' File "", line 1 s = 'aujo'urd"hui' ^ SyntaxError: invalid syntax >>> s = '''aujo'urd"hui''' >>> >>> >>> s = """aujo'urd"hui""" >>> >>> >>> s 'aujo\'urd"hui' >>> >>> >>> >>> s = 'abcdefghij' >>> >>> >>> s 'abcdefghij' >>> >>> >>> s[1] 'b' >>> >>> >>> s[0] 'a' >>> >>> >>> >>> s[8] 'i' >>> s[9] 'j' >>> s[10] Traceback (most recent call last): File "", line 1, in IndexError: string index out of range >>> s[-1] 'j' >>> >>> >>> s[-2] 'i' >>> s[-3] 'h' >>> s[-4] 'g' >>> s[-9] 'b' >>> s[-10] 'a' >>> s[-11] Traceback (most recent call last): File "", line 1, in IndexError: string index out of range >>> s 'abcdefghij' >>> >>> >>> s[2:5] 'cde' >>> >>> >>> s[2:10] 'cdefghij' >>> s[2:10:3] 'cfi' >>> >>> >>> >>> >>> s 'abcdefghij' >>> s + s 'abcdefghijabcdefghij' >>> >>> >>> >>> type(s) >>> >>> >>> help(s) No Python documentation found for 'abcdefghij'. Use help() to get the interactive help utility. Use help(str) for help on the str class. >>> help(str) >>> >>> >>> >>> s 'abcdefghij' >>> >>> t = 'xyz' >>> >>> >>> s < t True >>> >>> >>> s.__lt__(t) True >>> >>> >>> help(str) >>> >>> >>> s * 4 'abcdefghijabcdefghijabcdefghijabcdefghij' >>> >>> >>> s + s+ s+s 'abcdefghijabcdefghijabcdefghijabcdefghij' >>> >>> >>> >>> L = [] >>> >>> >>> type(L) >>> >>> >>> L = [23, 34.343, 'abc' , t, []] >>> >>> >>> L [23, 34.343, 'abc', 'xyz', []] >>> L[1] 34.343 >>> >>> >>> L[0] 23 >>> >>> L[-1] [] >>> L[-2] 'xyz' >>> L[-3] 'abc' >>> L[-4] 34.343 >>> L[-5] 23 >>> L[-6] Traceback (most recent call last): File "", line 1, in IndexError: list index out of range >>> >>> >>> >>> L + L [23, 34.343, 'abc', 'xyz', [], 23, 34.343, 'abc', 'xyz', []] >>> >>> >>> L[0:3] [23, 34.343, 'abc'] >>> >>> >>> L[:3] [23, 34.343, 'abc'] >>> >>> >>> L[:3] + L[3:] [23, 34.343, 'abc', 'xyz', []] >>> L[3:5] ['xyz', []] >>> L[3:] ['xyz', []] >>> L[3::2] ['xyz'] >>> >>> >>> s 'abcdefghij' >>> >>> >>> list(s) ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] >>> >>> L [23, 34.343, 'abc', 'xyz', []] >>> >>> >>> str(L) "[23, 34.343, 'abc', 'xyz', []]" >>> >>> >>> s 'abcdefghij' >>> str(list(s)) "['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']" >>> >>> >>> L [23, 34.343, 'abc', 'xyz', []] >>> >>> >>> L.append(232) >>> >>> L [23, 34.343, 'abc', 'xyz', [], 232] >>> >>> >>> dir(L) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] >>> >>> >>> >>> L + L [23, 34.343, 'abc', 'xyz', [], 232, 23, 34.343, 'abc', 'xyz', [], 232] >>> >>> 23 in L True >>> 12341324 in L False >>> L.__contains__(23) True >>> >>> 23 in L True >>> >>> L [23, 34.343, 'abc', 'xyz', [], 232] >>> >>> >>> del L[2] >>> L [23, 34.343, 'xyz', [], 232] >>> >>> >>> >>> L == L True >>> >>> >>> dir(L) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] >>> >>> L != L False >>> >>> >>> L [23, 34.343, 'xyz', [], 232] >>> K = [1,2,3,4] >>> L.extend(K) >>> L [23, 34.343, 'xyz', [], 232, 1, 2, 3, 4] >>> L [23, 34.343, 'xyz', [], 232, 1, 2, 3, 4] >>> K [1, 2, 3, 4] >>> L.index('xyz') 2 >>> >>> L.pop() 4 >>> >>> >>> >>> >>> L = [23, 34.343, 'abc' , t, []] >>> K = [1,2,3,4] >>> >>> id(L) 139927842786432 >>> L.extend(K) >>> L [23, 34.343, 'abc', 'xyz', [], 1, 2, 3, 4] >>> id(L) 139927842786432 >>> >>> >>> L = [23, 34.343, 'abc' , t, []] >>> K = [1,2,3,4] >>> L = L + K >>> L [23, 34.343, 'abc', 'xyz', [], 1, 2, 3, 4] >>> >>> id(L) 139927843984512 >>> >>> >>> >>> L = [23, 34.343, 'abc' , t, []] >>> id(L) 139927844064064 >>> K = [1,2,3,4] >>> L = L + K >>> L [23, 34.343, 'abc', 'xyz', [], 1, 2, 3, 4] >>> id(L) 139927842786432 >>> >>> >>> range(10) range(0, 10) >>> >>> list(range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> >>> >>> list(range(10, 20)) [10, 11, 12, 13, 14, 15, 16, 17, 18, 19] >>> list(range(10, 20, 3)) [10, 13, 16, 19] >>> >>> for i in range(10): ... print(i) ... 0 1 2 3 4 5 6 7 8 9 >>> >>> >>> >>> >>> [a**2 for a in range(10)] [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] >>> [a**2 for a in range(10) if a % 2 == 0] [0, 4, 16, 36, 64] >>> >>> >>> for i in range(10): ... print(i) ... 0 1 2 3 4 5 6 7 8 9 >>> >>> >>> L = [23, 34.343, 'abc' , t, []] >>> K = [1,2,3,4] >>> id(L) 139927844064064 >>> id(K) 139927842786432 >>> >>> L = K >>> id(L) 139927842786432 >>> id(K) 139927842786432 >>> >>> L = K >>> id(L) 139927842786432 >>> id(K) 139927842786432 >>> >>> >>> >>>