From 6c58161d3505d2d0a232fb1c72c80e33f0303bf0 Mon Sep 17 00:00:00 2001 From: Selena Huang Date: Fri, 18 Oct 2024 15:00:28 -0700 Subject: [PATCH 1/3] added codebyte example --- .../terms/linspace/linspace.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md b/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md index f35abefeb96..29b3d843910 100644 --- a/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md +++ b/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md @@ -66,3 +66,22 @@ This results in the following output: [3.4 4.4 5.4] [4. 5. 6. ]] ``` + +## Codebyte Example + +The following codebyte example illustrates the usage of the `linspace()` function with different inputs and flags. + +```codebyte/python +import numpy as np + +result, step_size = np.linspace(0, 20, num=5, retstep=True) +print("Resulting array: ", result) +print("Step size: ", step_size) + +result2, step_size2 = np.linspace(0, 20, num=5, endpoint=False, retstep=True) +print("Resulting array (without endpoint): ", result2) +print("Step size: ", step_size2) + +result3 = np.linspace([0, 10], [20, 100], num=8, axis=1) +print(result3) +``` From d22c09896a05f3606b5a402fa05f544ff8838272 Mon Sep 17 00:00:00 2001 From: Mamta Wardhani Date: Sat, 19 Oct 2024 17:17:31 +0530 Subject: [PATCH 2/3] Update linspace.md minor changes --- .../concepts/built-in-functions/terms/linspace/linspace.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md b/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md index 29b3d843910..35ce42adda4 100644 --- a/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md +++ b/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md @@ -69,7 +69,7 @@ This results in the following output: ## Codebyte Example -The following codebyte example illustrates the usage of the `linspace()` function with different inputs and flags. +Run the following codebyte example to understand the usage of the `linspace()` function with different inputs and flags: ```codebyte/python import numpy as np From 1277812edf4c2e079ba75f53843670549822229c Mon Sep 17 00:00:00 2001 From: Mamta Wardhani Date: Sat, 19 Oct 2024 17:19:16 +0530 Subject: [PATCH 3/3] Update linspace.md minor changes --- .../concepts/built-in-functions/terms/linspace/linspace.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md b/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md index 35ce42adda4..23547d2134d 100644 --- a/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md +++ b/content/numpy/concepts/built-in-functions/terms/linspace/linspace.md @@ -69,7 +69,7 @@ This results in the following output: ## Codebyte Example -Run the following codebyte example to understand the usage of the `linspace()` function with different inputs and flags: +Run the following codebyte example to understand the usage of the `linspace()` function with different inputs and parameters: ```codebyte/python import numpy as np