From b6c09729076ef3af1feffc08936f18b773223cf0 Mon Sep 17 00:00:00 2001 From: Aniruddh Ramanujam Date: Fri, 30 Oct 2020 16:45:38 +0530 Subject: [PATCH] Update --- .../Modules_and_Packages-checkpoint.ipynb | 84 +++- Modules_and_Packages.ipynb | 437 +++++++++++++++++- 2 files changed, 513 insertions(+), 8 deletions(-) diff --git a/.ipynb_checkpoints/Modules_and_Packages-checkpoint.ipynb b/.ipynb_checkpoints/Modules_and_Packages-checkpoint.ipynb index 5e94980..ed386f0 100644 --- a/.ipynb_checkpoints/Modules_and_Packages-checkpoint.ipynb +++ b/.ipynb_checkpoints/Modules_and_Packages-checkpoint.ipynb @@ -651,6 +651,21 @@ "print(__primeval__)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## globals(), locals() and reload()\n", + "\n", + "globals - returns the list of objects that can be accessed globally from that point.\n", + "\n", + "locals - returns the list of objects that can be accessed locally from that point.\n", + "\n", + "reload - reloads the given module. (imported from impotlib module)\n", + "\n", + "Syntax: `reload(module_name)`" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -798,15 +813,15 @@ } ], "source": [ - "math.pow(2, 3)" + "math.pow(2, 3) # 2 ** 3" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "$^5P_2$ \n", - "$^5C_2$" + "$\\mathit{^5P_2}$ \n", + "$\\mathit{^5C_2}$" ] }, { @@ -846,7 +861,68 @@ } ], "source": [ - "math.comb(5, 2)" + "math.comb(5, 2) # 5C2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## cmath:\n", + "Like math, used to work with complex numbers." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "__doc__\n", + "__loader__\n", + "__name__\n", + "__package__\n", + "__spec__\n", + "acos\n", + "acosh\n", + "asin\n", + "asinh\n", + "atan\n", + "atanh\n", + "cos\n", + "cosh\n", + "e\n", + "exp\n", + "inf\n", + "infj\n", + "isclose\n", + "isfinite\n", + "isinf\n", + "isnan\n", + "log\n", + "log10\n", + "nan\n", + "nanj\n", + "phase\n", + "pi\n", + "polar\n", + "rect\n", + "sin\n", + "sinh\n", + "sqrt\n", + "tan\n", + "tanh\n", + "tau\n" + ] + } + ], + "source": [ + "import cmath\n", + "\n", + "print(*dir(cmath), sep='\\n')" ] }, { diff --git a/Modules_and_Packages.ipynb b/Modules_and_Packages.ipynb index 5e94980..9186f6f 100644 --- a/Modules_and_Packages.ipynb +++ b/Modules_and_Packages.ipynb @@ -651,6 +651,21 @@ "print(__primeval__)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## globals(), locals() and reload()\n", + "\n", + "globals - returns the list of objects that can be accessed globally from that point.\n", + "\n", + "locals - returns the list of objects that can be accessed locally from that point.\n", + "\n", + "reload - reloads the given module. (imported from impotlib module)\n", + "\n", + "Syntax: `reload(module_name)`" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -798,15 +813,15 @@ } ], "source": [ - "math.pow(2, 3)" + "math.pow(2, 3) # 2 ** 3" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "$^5P_2$ \n", - "$^5C_2$" + "$\\mathit{^5P_2}$ \n", + "$\\mathit{^5C_2}$" ] }, { @@ -846,7 +861,421 @@ } ], "source": [ - "math.comb(5, 2)" + "math.comb(5, 2) # 5C2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## cmath:\n", + "Like math, used to work with complex numbers." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "__doc__\n", + "__loader__\n", + "__name__\n", + "__package__\n", + "__spec__\n", + "acos\n", + "acosh\n", + "asin\n", + "asinh\n", + "atan\n", + "atanh\n", + "cos\n", + "cosh\n", + "e\n", + "exp\n", + "inf\n", + "infj\n", + "isclose\n", + "isfinite\n", + "isinf\n", + "isnan\n", + "log\n", + "log10\n", + "nan\n", + "nanj\n", + "phase\n", + "pi\n", + "polar\n", + "rect\n", + "sin\n", + "sinh\n", + "sqrt\n", + "tan\n", + "tanh\n", + "tau\n" + ] + } + ], + "source": [ + "import cmath\n", + "\n", + "print(*dir(cmath), sep='\\n')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## sys:\n", + "\n", + "Work with program execution and system." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "__breakpointhook__\n", + "__displayhook__\n", + "__doc__\n", + "__excepthook__\n", + "__interactivehook__\n", + "__loader__\n", + "__name__\n", + "__package__\n", + "__spec__\n", + "__stderr__\n", + "__stdin__\n", + "__stdout__\n", + "__unraisablehook__\n", + "_base_executable\n", + "_clear_type_cache\n", + "_current_frames\n", + "_debugmallocstats\n", + "_enablelegacywindowsfsencoding\n", + "_framework\n", + "_getframe\n", + "_git\n", + "_home\n", + "_xoptions\n", + "addaudithook\n", + "api_version\n", + "argv\n", + "audit\n", + "base_exec_prefix\n", + "base_prefix\n", + "breakpointhook\n", + "builtin_module_names\n", + "byteorder\n", + "call_tracing\n", + "callstats\n", + "copyright\n", + "displayhook\n", + "dllhandle\n", + "dont_write_bytecode\n", + "exc_info\n", + "excepthook\n", + "exec_prefix\n", + "executable\n", + "exit\n", + "flags\n", + "float_info\n", + "float_repr_style\n", + "get_asyncgen_hooks\n", + "get_coroutine_origin_tracking_depth\n", + "getallocatedblocks\n", + "getcheckinterval\n", + "getdefaultencoding\n", + "getfilesystemencodeerrors\n", + "getfilesystemencoding\n", + "getprofile\n", + "getrecursionlimit\n", + "getrefcount\n", + "getsizeof\n", + "getswitchinterval\n", + "gettrace\n", + "getwindowsversion\n", + "hash_info\n", + "hexversion\n", + "implementation\n", + "int_info\n", + "intern\n", + "is_finalizing\n", + "maxsize\n", + "maxunicode\n", + "meta_path\n", + "modules\n", + "path\n", + "path_hooks\n", + "path_importer_cache\n", + "platform\n", + "prefix\n", + "ps1\n", + "ps2\n", + "ps3\n", + "pycache_prefix\n", + "set_asyncgen_hooks\n", + "set_coroutine_origin_tracking_depth\n", + "setcheckinterval\n", + "setprofile\n", + "setrecursionlimit\n", + "setswitchinterval\n", + "settrace\n", + "stderr\n", + "stdin\n", + "stdout\n", + "thread_info\n", + "unraisablehook\n", + "version\n", + "version_info\n", + "warnoptions\n", + "winver\n" + ] + } + ], + "source": [ + "import sys\n", + "\n", + "print(*dir(sys), sep='\\n')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## os:\n", + "works with operating system" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "DirEntry\n", + "F_OK\n", + "MutableMapping\n", + "O_APPEND\n", + "O_BINARY\n", + "O_CREAT\n", + "O_EXCL\n", + "O_NOINHERIT\n", + "O_RANDOM\n", + "O_RDONLY\n", + "O_RDWR\n", + "O_SEQUENTIAL\n", + "O_SHORT_LIVED\n", + "O_TEMPORARY\n", + "O_TEXT\n", + "O_TRUNC\n", + "O_WRONLY\n", + "P_DETACH\n", + "P_NOWAIT\n", + "P_NOWAITO\n", + "P_OVERLAY\n", + "P_WAIT\n", + "PathLike\n", + "R_OK\n", + "SEEK_CUR\n", + "SEEK_END\n", + "SEEK_SET\n", + "TMP_MAX\n", + "W_OK\n", + "X_OK\n", + "_AddedDllDirectory\n", + "_Environ\n", + "__all__\n", + "__builtins__\n", + "__cached__\n", + "__doc__\n", + "__file__\n", + "__loader__\n", + "__name__\n", + "__package__\n", + "__spec__\n", + "_check_methods\n", + "_execvpe\n", + "_exists\n", + "_exit\n", + "_fspath\n", + "_get_exports_list\n", + "_putenv\n", + "_unsetenv\n", + "_wrap_close\n", + "abc\n", + "abort\n", + "access\n", + "add_dll_directory\n", + "altsep\n", + "chdir\n", + "chmod\n", + "close\n", + "closerange\n", + "cpu_count\n", + "curdir\n", + "defpath\n", + "device_encoding\n", + "devnull\n", + "dup\n", + "dup2\n", + "environ\n", + "error\n", + "execl\n", + "execle\n", + "execlp\n", + "execlpe\n", + "execv\n", + "execve\n", + "execvp\n", + "execvpe\n", + "extsep\n", + "fdopen\n", + "fsdecode\n", + "fsencode\n", + "fspath\n", + "fstat\n", + "fsync\n", + "ftruncate\n", + "get_exec_path\n", + "get_handle_inheritable\n", + "get_inheritable\n", + "get_terminal_size\n", + "getcwd\n", + "getcwdb\n", + "getenv\n", + "getlogin\n", + "getpid\n", + "getppid\n", + "isatty\n", + "kill\n", + "linesep\n", + "link\n", + "listdir\n", + "lseek\n", + "lstat\n", + "makedirs\n", + "mkdir\n", + "name\n", + "open\n", + "pardir\n", + "path\n", + "pathsep\n", + "pipe\n", + "popen\n", + "putenv\n", + "read\n", + "readlink\n", + "remove\n", + "removedirs\n", + "rename\n", + "renames\n", + "replace\n", + "rmdir\n", + "scandir\n", + "sep\n", + "set_handle_inheritable\n", + "set_inheritable\n", + "spawnl\n", + "spawnle\n", + "spawnv\n", + "spawnve\n", + "st\n", + "startfile\n", + "stat\n", + "stat_result\n", + "statvfs_result\n", + "strerror\n", + "supports_bytes_environ\n", + "supports_dir_fd\n", + "supports_effective_ids\n", + "supports_fd\n", + "supports_follow_symlinks\n", + "symlink\n", + "sys\n", + "system\n", + "terminal_size\n", + "times\n", + "times_result\n", + "truncate\n", + "umask\n", + "uname_result\n", + "unlink\n", + "urandom\n", + "utime\n", + "waitpid\n", + "walk\n", + "write\n" + ] + } + ], + "source": [ + "import os\n", + "print(*dir(os), sep='\\n')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## itertools:\n", + "\n", + "A module containing iterators for efficient looping" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "__doc__\n", + "__loader__\n", + "__name__\n", + "__package__\n", + "__spec__\n", + "_grouper\n", + "_tee\n", + "_tee_dataobject\n", + "accumulate\n", + "chain\n", + "combinations\n", + "combinations_with_replacement\n", + "compress\n", + "count\n", + "cycle\n", + "dropwhile\n", + "filterfalse\n", + "groupby\n", + "islice\n", + "permutations\n", + "product\n", + "repeat\n", + "starmap\n", + "takewhile\n", + "tee\n", + "zip_longest\n" + ] + } + ], + "source": [ + "import itertools\n", + "\n", + "print(*dir(itertools), sep='\\n')" ] }, {