{"id":101,"date":"2020-06-25T20:16:11","date_gmt":"2020-06-25T20:16:11","guid":{"rendered":"https:\/\/aaidm.buas.nl\/?page_id=101"},"modified":"2020-07-06T19:06:52","modified_gmt":"2020-07-06T19:06:52","slug":"pr1-week-1","status":"publish","type":"page","link":"https:\/\/aaidm.buas.nl\/?page_id=101","title":{"rendered":"PR1 &#8211; Preparation for Week 3 &#8211; Functions"},"content":{"rendered":"\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Author:<\/td><td>Carlos Santos<\/td><\/tr><tr><td>Learning Line:<\/td><td>Programming<\/td><\/tr><tr><td>Course:<\/td><td>PR1: Introduction to Programming<\/td><\/tr><tr><td>Week:<\/td><td>3<\/td><\/tr><tr><td>Competencies:<\/td><td>Students will be able to effectively define and use variables, programming flow control.<\/td><\/tr><tr><td>BoKS:<\/td><td>\u00ad 3bK2, The student understands the principles of data related software like Python, R, Scala and\/or Java and knows how to write (basic) scripts.<\/td><\/tr><tr><td>Learning Goals:<\/td><td>Variables and Data Types<br>In-code Comments<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Functions<\/h3>\n\n\n\n<p>A function is a block of code which only runs when it is called. You can pass parameters, into a function, and it can return data as a result.<\/p>\n\n\n\n<p>You can see a function as a group of related instructions that performs a specific task. Functions help break our program into smaller chunks, it is the main way to support modular programming, and avoids repetition. In short makes the code reusable.<\/p>\n\n\n\n<p>It as very similar concept in math:<\/p>\n\n\n\n<div class=\"wp-block-katex-display-block katex-eq\" data-katex-display=\"true\">f(x,y) = x^2+y<\/div>\n\n\n\n<p>can be written in python as:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def f(x, y):\n  return x**2 + y\n\nf(2,3)\n7\nf(0,1)\n1<\/pre><\/div>\n\n\n\n<p>The premises are similar, <em>f<\/em> is a function with two parameters <em>x<\/em>, and <em>y<\/em>. Parameters are special variables, normally required to calculate the result, of the function.<\/p>\n\n\n\n<p>Functions are not required to have parameters or return values.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def printHello():\n  print(&quot;Hello function&quot;)\n\nprintHello()\nHello function<\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Parameter naming<\/h4>\n\n\n\n<p>The parameters names are important, since, you can use them to assure, you pass the correct information, and even reorder them is required.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def show3(n1, n2, n3):\n  print(&quot;Show n1: &quot; + str(n1))\n  print(&quot;Show n2: &quot; + str(n2))\n  print(&quot;Show n3: &quot; + str(n3))\n\nshow3(n3 = 3, n2 = 2, n1 = 1)\nShow n1: 1\nShow n2: 2  \nShow n3: 3<\/pre><\/div>\n\n\n\n<p><strong>Important:<\/strong> The instructions set of a functions all have the same level, meaning they all have the same trailing number of spaces\/tabs. A function ends when the spacing returns to the previous level.<\/p>\n\n\n\n<p>Parameter Default values<\/p>\n\n\n\n<p>The parameters may have default values, it will assume the specified value if  not specified. This is where the parameters names are also very important.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def g(a,b = 2, c= 1):\n  return a**b-c\n\ng(3)\n8\ng(3,2,3)\n6\ng(50,0)\n0\ng(2,c=3)\n1<\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Multiple return values<\/h4>\n\n\n\n<p>There is no limitations with regards to the number of return values, i.e., you can return more than one (not all programming languages allow this).<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def getNeighbours(x):\n  return x-1, x+1\n\ngetNeighbours(1)\n(0, 2)\nm, M = getNeighbours(3)\nprint(m)\n2\nprint(M)\n4<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Scopes<\/h2>\n\n\n\n<p>Whenever you define a variable within a function, its scope lies ONLY within the function. It is accessible from the point at which it is defined until the end of the function. Which means its value cannot be changed or even accessed from outside the function. Let&#8217;s take a simple example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def functionScope():\n\tx = 10\n\tprint(&quot;Value inside function:&quot;+str(x))\n\nx = 20\nfunctionScope()\nprint(&quot;Value outside function:&quot;+str(x))<\/pre><\/div>\n\n\n\n<p><strong>Note<\/strong> that in fact there are 2 variables declared, both are named <em>x<\/em> (line 2 and 5). They are in different scopes, one inside of the function (named <em>functionScope<\/em>), and the other in the base scope, known as <strong>global <\/strong>scope.<\/p>\n\n\n\n<p>Scopes are important concepts to grasp, since, it might bring you a lot of trouble if they are not handled correctly. In Python they are illustrated by the spacing at the beginning of the  instruction. This is called <strong>indentation<\/strong>.<\/p>\n\n\n\n<p><strong>Note <\/strong>that variables that are declared in a specific scope are available in sub-scopes. <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">a = 1\ndef functionThatUsesA(x):\n    return x + a\n  \nfunctionThatUsesA(3)\n4<\/pre><\/div>\n\n\n\n<p>This type of programming is to be avoided, not only it is confusing, but, also it may create weird artifacts, and becomes difficult to read. The following code is valid, although difficult to read even for experienced programmers. So it is better to avoid it.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">globalVar = 1\n\ndef functionScope1():\n    localVar1 = 2\n    localVar2 = 3\n    def functionScope2():\n        localVar1 = 4\n        localVar3 = 5\n        \n        return globalVar + localVar1 + localVar2 + localVar3\n    \n    return localVar1 + functionScope2()\n\nfunctionScope1()<\/pre><\/div>\n\n\n\n<p>Explanation: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><em>globalVar <\/em>(orange) is a global variable reachable in all scopes<\/li><li><em>localVar1 <\/em>(blue) was defined inside <em>functionScope1<\/em> and available both <em>functionScope1<\/em> and <em>functionScope2<\/em> <\/li><li><em>localVar2 <\/em>(blue) was defined inside <em>functionScope1<\/em> and available both <em>functionScope1<\/em> and <em>functionScope2<\/em><\/li><li><em>localVar1 <\/em>(pink) was defined inside <em>functionScope2 <\/em>and only inside <em>functionScope2<\/em>, and replacing the definition <em>localVar1 <\/em>(blue) inside <em>functionScope2<\/em><\/li><li><em>localVar3 <\/em>(pink) was defined inside <em>functionScope2 <\/em>and only inside <em>functionScope2<\/em><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png\" alt=\"\" class=\"wp-image-290\" width=\"403\" height=\"218\" srcset=\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png 446w, https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1-300x162.png 300w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Function Documentation<\/h3>\n\n\n\n<p>Functions can (and should) be properly documented, this will help not only to understand the goal, of each function, but also clarify the role of each parameter of the function.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def increase(x, v = 1):\n  &quot;&quot;&quot;\n    This function increases the value of x, by the amount of v (default 1)\n  &quot;&quot;&quot;\n  return x + v\n\nincrease(3)\n4\n\nhelp(increase)\nincrease(x, v=1)\n    This function increases the value of x, by the amount of v (default 1)<\/pre><\/div>\n\n\n\n<p>Documenting your functions is important, for supporting readability of your code. <\/p>\n\n\n\n<p>Not all functions are required to be documented, but, it helps a lot to understand its purpose, and clarify any parameter, either for yourself or someone else.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Rule of thumb about documentation and code comment, answer this two questions:<\/p><p>&#8211; Will someone reuse this in the next two years?<\/p><p>&#8211; Will it take more time for him to understand what does the function do than me writing an explanation?<\/p><p>If for both question is a <strong>Clear No<\/strong>, then don&#8217;t bother. Otherwise, if it is a maybe or yes then document it.<\/p><\/blockquote>\n\n\n\n<p>Important to notice, that native functions from python are documented, meaning it has native documentation, by just typing help. In there, you can also see all the parameters.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">help(print)\nHelp on built-in function print in module builtins:\n\nprint(...)\n    print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n    \n    Prints the values to a stream, or to sys.stdout by default.\n    Optional keyword arguments:\n    file:  a file-like object (stream); defaults to the current sys.stdout.\n    sep:   string inserted between values, default a space.\n    end:   string appended after the last value, default a newline.\n    flush: whether to forcibly flush the stream.<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Explicit Types<\/h3>\n\n\n\n<p>You can explicit define parameter and return value types for functions. In some other programming languages this is mandatory, in python although it is possible it is uncommon among python programmers. <\/p>\n\n\n\n<p>Personally, I only use them to increase even further readability, so myself or others will use this module often, or frequently and it may be obscure the parameter type.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;idea&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">def h(name: str, age : int) -&gt; str:\n    return name +&quot; is &quot;+str(age)+&quot; years old&quot;<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Further Reading \/ Studying<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.programiz.com\/python-programming\/function\">https:\/\/www.programiz.com\/python-programming\/function<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.datacamp.com\/community\/tutorials\/scope-of-variables-python\">https:\/\/www.datacamp.com\/community\/tutorials\/scope-of-variables-python<\/a><\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Python Tutorial for Beginners 8: Functions\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/9Os0o3wzS_I?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Exercises<\/h2>\n\n\n\n<p>1. Create a function that receives an integers and returns a boolean True, if it is odd and False if it is even.<\/p>\n\n\n\n<p>tip: you can use the mod operator (%)<\/p>\n\n\n\n<p>2. Create a function that calculates the Body Mass Index <\/p>\n\n\n\n<div class=\"wp-block-katex-display-block katex-eq\" data-katex-display=\"true\">Bmi(height, weight) = \\frac {height} {weight^2}<\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>3. Create a function that calculates the average of 5 float values.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: Carlos Santos Learning Line: Programming Course: PR1: Introduction to Programming Week: 3 Competencies: Students will be able to effectively define and use variables, programming flow control. BoKS: \u00ad 3bK2, The student understands the principles of data related software like Python, R, Scala and\/or Java and knows how to write (basic) scripts. Learning Goals: Variables [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"parent":99,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-101","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PR1 - Preparation for Week 3 - Functions - Applied Artificial Intelligence and Data Management<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/aaidm.buas.nl\/?page_id=101\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PR1 - Preparation for Week 3 - Functions - Applied Artificial Intelligence and Data Management\" \/>\n<meta property=\"og:description\" content=\"Author: Carlos Santos Learning Line: Programming Course: PR1: Introduction to Programming Week: 3 Competencies: Students will be able to effectively define and use variables, programming flow control. BoKS: \u00ad 3bK2, The student understands the principles of data related software like Python, R, Scala and\/or Java and knows how to write (basic) scripts. Learning Goals: Variables [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/aaidm.buas.nl\/?page_id=101\" \/>\n<meta property=\"og:site_name\" content=\"Applied Artificial Intelligence and Data Management\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-06T19:06:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/aaidm.buas.nl\/?page_id=101\",\"url\":\"https:\/\/aaidm.buas.nl\/?page_id=101\",\"name\":\"PR1 - Preparation for Week 3 - Functions - Applied Artificial Intelligence and Data Management\",\"isPartOf\":{\"@id\":\"https:\/\/aaidm.buas.nl\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/aaidm.buas.nl\/?page_id=101#primaryimage\"},\"image\":{\"@id\":\"https:\/\/aaidm.buas.nl\/?page_id=101#primaryimage\"},\"thumbnailUrl\":\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png\",\"datePublished\":\"2020-06-25T20:16:11+00:00\",\"dateModified\":\"2020-07-06T19:06:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/aaidm.buas.nl\/?page_id=101#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/aaidm.buas.nl\/?page_id=101\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/aaidm.buas.nl\/?page_id=101#primaryimage\",\"url\":\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png\",\"contentUrl\":\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png\",\"width\":446,\"height\":241},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/aaidm.buas.nl\/?page_id=101#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/aaidm.buas.nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Year 1\",\"item\":\"https:\/\/aaidm.buas.nl\/?page_id=80\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Year 1 &#8211; Block A\",\"item\":\"https:\/\/aaidm.buas.nl\/?page_id=82\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"PR1: Introduction to Programming\",\"item\":\"https:\/\/aaidm.buas.nl\/?page_id=99\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"PR1 &#8211; Preparation for Week 3 &#8211; Functions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/aaidm.buas.nl\/#website\",\"url\":\"https:\/\/aaidm.buas.nl\/\",\"name\":\"Applied Artificial Intelligence and Data Management\",\"description\":\"Course Information\",\"publisher\":{\"@id\":\"https:\/\/aaidm.buas.nl\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/aaidm.buas.nl\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/aaidm.buas.nl\/#organization\",\"name\":\"Applied Artificial Intelligence and Data Management\",\"url\":\"https:\/\/aaidm.buas.nl\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/aaidm.buas.nl\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/06\/buas-logo.png\",\"contentUrl\":\"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/06\/buas-logo.png\",\"width\":382,\"height\":132,\"caption\":\"Applied Artificial Intelligence and Data Management\"},\"image\":{\"@id\":\"https:\/\/aaidm.buas.nl\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PR1 - Preparation for Week 3 - Functions - Applied Artificial Intelligence and Data Management","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/aaidm.buas.nl\/?page_id=101","og_locale":"en_US","og_type":"article","og_title":"PR1 - Preparation for Week 3 - Functions - Applied Artificial Intelligence and Data Management","og_description":"Author: Carlos Santos Learning Line: Programming Course: PR1: Introduction to Programming Week: 3 Competencies: Students will be able to effectively define and use variables, programming flow control. BoKS: \u00ad 3bK2, The student understands the principles of data related software like Python, R, Scala and\/or Java and knows how to write (basic) scripts. Learning Goals: Variables [&hellip;]","og_url":"https:\/\/aaidm.buas.nl\/?page_id=101","og_site_name":"Applied Artificial Intelligence and Data Management","article_modified_time":"2020-07-06T19:06:52+00:00","og_image":[{"url":"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/aaidm.buas.nl\/?page_id=101","url":"https:\/\/aaidm.buas.nl\/?page_id=101","name":"PR1 - Preparation for Week 3 - Functions - Applied Artificial Intelligence and Data Management","isPartOf":{"@id":"https:\/\/aaidm.buas.nl\/#website"},"primaryImageOfPage":{"@id":"https:\/\/aaidm.buas.nl\/?page_id=101#primaryimage"},"image":{"@id":"https:\/\/aaidm.buas.nl\/?page_id=101#primaryimage"},"thumbnailUrl":"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png","datePublished":"2020-06-25T20:16:11+00:00","dateModified":"2020-07-06T19:06:52+00:00","breadcrumb":{"@id":"https:\/\/aaidm.buas.nl\/?page_id=101#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/aaidm.buas.nl\/?page_id=101"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/aaidm.buas.nl\/?page_id=101#primaryimage","url":"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png","contentUrl":"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/07\/image-1.png","width":446,"height":241},{"@type":"BreadcrumbList","@id":"https:\/\/aaidm.buas.nl\/?page_id=101#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/aaidm.buas.nl\/"},{"@type":"ListItem","position":2,"name":"Year 1","item":"https:\/\/aaidm.buas.nl\/?page_id=80"},{"@type":"ListItem","position":3,"name":"Year 1 &#8211; Block A","item":"https:\/\/aaidm.buas.nl\/?page_id=82"},{"@type":"ListItem","position":4,"name":"PR1: Introduction to Programming","item":"https:\/\/aaidm.buas.nl\/?page_id=99"},{"@type":"ListItem","position":5,"name":"PR1 &#8211; Preparation for Week 3 &#8211; Functions"}]},{"@type":"WebSite","@id":"https:\/\/aaidm.buas.nl\/#website","url":"https:\/\/aaidm.buas.nl\/","name":"Applied Artificial Intelligence and Data Management","description":"Course Information","publisher":{"@id":"https:\/\/aaidm.buas.nl\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/aaidm.buas.nl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/aaidm.buas.nl\/#organization","name":"Applied Artificial Intelligence and Data Management","url":"https:\/\/aaidm.buas.nl\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/aaidm.buas.nl\/#\/schema\/logo\/image\/","url":"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/06\/buas-logo.png","contentUrl":"https:\/\/aaidm.buas.nl\/wp-content\/uploads\/2020\/06\/buas-logo.png","width":382,"height":132,"caption":"Applied Artificial Intelligence and Data Management"},"image":{"@id":"https:\/\/aaidm.buas.nl\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=\/wp\/v2\/pages\/101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=101"}],"version-history":[{"count":19,"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=\/wp\/v2\/pages\/101\/revisions"}],"predecessor-version":[{"id":324,"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=\/wp\/v2\/pages\/101\/revisions\/324"}],"up":[{"embeddable":true,"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=\/wp\/v2\/pages\/99"}],"wp:attachment":[{"href":"https:\/\/aaidm.buas.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}