From fae7b9bcc0f17eedea854a5789333f800e580b70 Mon Sep 17 00:00:00 2001 From: Auke Klazema <klazema@astron.nl> Date: Fri, 19 Nov 2021 15:34:19 +0100 Subject: [PATCH] Small clarification on methods --- IntroProgrammingInPython.ipynb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IntroProgrammingInPython.ipynb b/IntroProgrammingInPython.ipynb index 0ac9382..4f3579c 100644 --- a/IntroProgrammingInPython.ipynb +++ b/IntroProgrammingInPython.ipynb @@ -1395,7 +1395,7 @@ "\n", "So an object is formally an instance of a class. Where the class forms the blueprint from which you can create objects. An object is a shell around data that can be manipulated with methods provided by the object. The data can be directly exposed but most of the time its hidden.\n", "\n", - "This gives us programmers a new form of syntax for dealing with objects. Methods are functions on an object and are called on the object by adding a . to the end of the instance and the name of the method.\n", + "This gives us programmers a new form of syntax for dealing with objects. Methods are functions on an object and are called on the object by adding a . to the end of the instance and the name of the method followed with set of parentheses and maybe some parameters between them.\n", "\n", "For example:" ] @@ -1408,7 +1408,8 @@ "outputs": [], "source": [ "hello = \"Hello\"\n", - "hello.upper()" + "print(hello.upper())\n", + "print(hello)" ] }, { -- GitLab