From 76a0ad007a9fbd91b61391ae34b6732d5c9c0fdc Mon Sep 17 00:00:00 2001 From: Eise Nota <128397701+EiseWN@users.noreply.github.com> Date: Sun, 1 Oct 2023 12:06:42 +0200 Subject: [PATCH] Update chapter_2.md --- course/practicals/chapter_2.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/course/practicals/chapter_2.md b/course/practicals/chapter_2.md index 8f46b95..d5e6143 100644 --- a/course/practicals/chapter_2.md +++ b/course/practicals/chapter_2.md @@ -628,11 +628,12 @@ For illustrative purposes, let's start with an example of a function that is so # input R radius(m) # h cylinder height(m) import numpy as np - def a_circ(R): - return 2*np.pi*(R**2) - def a_lat(R,h): - return 2*np.pi*R*h - return a_lat(R,h)+a_circ(R) + # first calculate the area of the circles at the top and base + a_circ = 2*np.pi*(R**2) + # then calculate the area of the side of the cylinder (= lateral area) + a_lat = 2*np.pi*R*h + # return the entire cylinder area as a sum of both + return a_lat+a_circ ``` - Now try call upon these functions specifying a radius of ```2``` and a height of ```3```. Do you understand the results?