{"id":241,"date":"2010-08-27T18:12:09","date_gmt":"2010-08-27T18:12:09","guid":{"rendered":"http:\/\/cemclinux1.math.uwaterloo.ca\/~cscircles\/wordpress\/"},"modified":"2019-08-16T15:31:49","modified_gmt":"2019-08-16T07:31:49","slug":"1-variables","status":"publish","type":"page","link":"https:\/\/olescs.hkmu.edu.hk\/python\/1-variables\/","title":{"rendered":"1: Variables"},"content":{"rendered":"<p><!-- Please retain this notice and add more notes if you create a new version. Original lesson author: David Pritchard, daveagp@gmail.com, http:\/\/cscircles.ca License: http:\/\/creativecommons.org\/licenses\/by-nc-sa\/3.0\/--> Variables act as \"storage locations\" for data in a program. They are a way of naming information for later usage. Each variable has a <em>name<\/em>; an example variable name we will use is&nbsp;<code>myLuckyNumber<\/code>. To store information in a variable, we write a command using an equal sign in the following way:<\/p>\n<pre>\u00abthe variable name\u00bb&nbsp;= \u00abthe value you want to store\u00bb<\/pre>(We use \u00abdouble angle brackets\u00bb in our lessons, like above, to indicate special parts of expressions.) For example, the Python line<\/p>\n<pre>myLuckyNumber = 13<\/pre>stores the value <code>13<\/code> in the variable <code>myLuckyNumber<\/code>. Then, anywhere you write the variable name <code>myLuckyNumber<\/code>&nbsp;again, Python retrieves the stored value. Below, there is a short example of using variables. It has more than one line of instructions: Python executes the first line, then the second line, and so forth until it reaches the last line. Press the <strong>Run program<\/strong> button to see what it does. <form class=\"pbform\" action=\"#\" id=\"pbform0\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox0'>\n<div class=\"heading\"><span class=\"title\">Example<\/span><\/div>Example of using a variable.<div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 136px;'><textarea wrap='off' name='usercode0' id='usercode0'  cols=10 rows=5 readonly='readonly'  style = 'height : 136px;'  class='pyboxCode RO'>\nmyLuckyNumber = 13\nprint(myLuckyNumber + 1)\nprint(myLuckyNumber)\nmyLuckyNumber = 5 + 2\nprint(myLuckyNumber)<\/textarea><\/div>\n<div id='pbhistory0' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit0' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"en-US\"\/><input type=\"hidden\" id=\"inputInUse0\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"0\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"5dd6ce21aa2745304a136e350e68828e\"\/>\n<div id='pbresults0' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit0\").value = \"Run program\";document.getElementById(\"inputInUse0\").value = \"N\";<\/script>\n Look at the 5 lines of the program in order, and how they correspond to the output. As you can see, <code><code>myLuckyNumber<\/code><\/code> keeps its value of <code>13<\/code> for the first two <code>print<\/code> statements, then its value is changed to <code>7<\/code>. We also introduced the <em>plus<\/em> operator (<code>+<\/code>) above, which adds two numbers together. Similarly, there are operators for subtraction (<code>-<\/code>), multiplication (<code>*<\/code>), and division (<code>\/<\/code>). We'll return to these in a later lesson. You can simulate the memory storage of a computer with paper and pencil, by keeping track of the values in a table. Here is an example; remember that&nbsp;<code>*<\/code> means multiplication in Python.<\/p>\n<div class=\"pybox\"><strong>Goal<\/strong>: determine the final values of all variables at the end of the program.&nbsp;&nbsp;<\/p>\n<pre>first = 2\nsecond = 3\nthird = first * second\nsecond = third - first\nfirst = first + second + third\nthird = second * first<\/pre><strong>Idea<\/strong>: We use a table to keep track of the values as they change. Scroll to the bottom to see the final answer.<\/p>\n<table style=\"margin-bottom: 0px; padding-right: 20px;\">\n<colgroup>\n<col width=\"55%\"> <\/colgroup>\n<colgroup>\n<col width=\"15%\">\n<col width=\"15%\">\n<col width=\"15%\"> <\/colgroup>\n<tbody>\n<tr align=\"center\">\n<th>Statement<\/th>\n<th colspan=\"3\">Values after statement executes<\/th>\n<\/tr>\n<tr class=\"mono\" align=\"center\">\n<th>&nbsp;<\/th>\n<th>first<\/th>\n<th>second<\/th>\n<th>third<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<div style=\"margin-top: 0px; overflow-y: scroll; max-height: 100px;\">\n<table class=\"mono\" style=\"margin-bottom: 5px;\">\n<colgroup>\n<col width=\"55%\"> <\/colgroup>\n<colgroup>\n<col width=\"15%\">\n<col width=\"15%\">\n<col width=\"15%\"> <\/colgroup>\n<tbody>\n<tr>\n<td>first = 2<\/td>\n<td><strong>2<\/strong><\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>second = 3<\/td>\n<td>2<\/td>\n<td><strong>3<\/strong><\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>third = first * second<\/td>\n<td>2<\/td>\n<td>3<\/td>\n<td><strong>6<\/strong><\/td>\n<\/tr>\n<tr>\n<td>second = third - first<\/td>\n<td>2<\/td>\n<td><span style=\"text-decoration: line-through;\">3<\/span> <strong>4<\/strong><\/td>\n<td>6<\/td>\n<\/tr>\n<tr>\n<td>first = first + second + third<\/td>\n<td><span style=\"text-decoration: line-through;\">2<\/span> <strong>12<\/strong><\/td>\n<td>4<\/td>\n<td>6<\/td>\n<\/tr>\n<tr>\n<td>third = second * first<\/td>\n<td>12<\/td>\n<td>4<\/td>\n<td><span style=\"text-decoration: line-through;\">6<\/span> <strong>48<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Thus at the end of the program, the value of <code>first<\/code> is <code>12<\/code>, the value of <code>second<\/code> is <code>4<\/code>, and the value of <code>third<\/code> is <code>48<\/code>.<\/p>\n<\/div>\n<\/div>\n<p>Drawing a table like this on pencil and paper is always a good idea and helpful when understanding or fixing code. We also have an automated&nbsp;<a href=\"\/visualize\">Python3 visualization tool<\/a> to virtually execute programs like this one step at a time (see also the link in the top menu). Here's what it looks like when we run the same program on the visualizer. <em>Use the <strong>Forward &gt;<\/strong>&nbsp;button or press the arrow key on your keyboard to step forward (or back).&nbsp;<\/em>Note how the variables change as each line executes. <iframe width='100%' height='480' frameborder='0' scrolling='no' src='https:\/\/olescs.hkmu.edu.hk\/python\/wp-content\/plugins\/pybox\/OnlinePythonTutor3-cemc\/iframe-embed.html#code=first+%3D+2%0Asecond+%3D+3%0Athird+%3D+first+%2A+second%0Asecond+%3D+third+-+first%0Afirst+%3D+first+%2B+second+%2B+third%0Athird+%3D+second+%2A+first&cumulative=false&heapPrimitives=false&drawParentPointers=false&textReferences=false&showOnlyOutputs=false&py=3&curInstr=0&resizeContainer=true&highlightLines&width=400&rightStdout=1'><\/iframe> Here is a short answer exercise about variables. <div class='pybox modeNeutral' id='pybox1'>\n<img title='You have not yet completed this problem.' src='https:\/\/olescs.hkmu.edu.hk\/python\/wp-content\/plugins\/pybox\/files\/icon.png' class='pycheck'\/><div class=\"heading\"><span class='type'>Short Answer Exercise: <\/span><span class='title'><code>x<\/code> Marks the Spot<\/span><\/div> What is the value of <code>x<\/code> after these commands execute? <\/p>\n<pre>x = 10<br\/>x = x + x<br\/>x = x - 5<\/pre><label for=\"pyShortAnswer1\">Your answer (enter a number): <\/label><input type=\"text\" onkeypress=\"{if (event.keyCode==13) pbShortCheck(1)}\" id=\"pyShortAnswer1\"><div class=\"pyboxbuttons\"><input type=\"hidden\" name=\"type\" value=\"number\"\/><input type=\"hidden\" name=\"correct\" value=\"15\"\/><input type=\"hidden\" name=\"slug\" value=\"1.plusminus\"\/><input type=\"hidden\" name=\"lang\" value=\"en-US\"\/><input type='submit' style='margin:5px;' value='Check answer' onClick = 'pbShortCheck(1)'\/><\/div><div class=\"pbresults\" id=\"pyShortResults1\"><\/div><div class=\"epilogue\">Correct!<\/div><\/div>\n<h2>Two Common Errors<\/h2>\n<p>If you ask Python about a variable that has not been defined, you get an error. <form class=\"pbform\" action=\"#\" id=\"pbform2\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox2'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'>An Undefined Variable<\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 32px;'><textarea wrap='off' name='usercode2' id='usercode2'  cols=10 rows=1 readonly='readonly'  style = 'height : 32px;'  class='pyboxCode RO'>\nprint(trouble)<\/textarea><\/div>\n<div id='pbhistory2' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit2' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"en-US\"\/><input type=\"hidden\" id=\"inputInUse2\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"2\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"dadd98bf0d5e13850b0b83c370a3bc89\"\/>\n<div id='pbresults2' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit2\").value = \"Run program\";document.getElementById(\"inputInUse2\").value = \"N\";<\/script>\n As you can see, we get an error message saying&nbsp;<code>NameError: name 'trouble' is not defined<\/code>. Sometimes you can get errors like this from simple typos: if you define a variable&nbsp;<code>address=32<\/code>, then try to&nbsp;<code>print(adress)<\/code>, the same type of error occurs. Another error has to do with accidentally swapping the sides of an&nbsp;<code>=<\/code>&nbsp;statement. <form class=\"pbform\" action=\"#\" id=\"pbform3\" method=\"POST\">\n<div class='pybox modeNeutral  facultative' id='pybox3'>\n<div class=\"heading\"><span class='type'>Example: <\/span><span class='title'><code>SyntaxError: can't assign to literal<\/code><\/span><\/div> <div class='pyboxTextwrap pyboxCodewrap RO '  style='height: 58px;'><textarea wrap='off' name='usercode3' id='usercode3'  cols=10 rows=2 readonly='readonly'  style = 'height : 58px;'  class='pyboxCode RO'>\nx = 4\n4 = x<\/textarea><\/div>\n<div id='pbhistory3' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit3' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"en-US\"\/><input type=\"hidden\" id=\"inputInUse3\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"3\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"130cb3846431645709a90d52b640f87e\"\/>\n<div id='pbresults3' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit3\").value = \"Run program\";document.getElementById(\"inputInUse3\").value = \"N\";<\/script>\n The first line is fine but the second line causes an error: Python thinks the second line&nbsp;<code>4 = x<\/code>&nbsp;is trying to change the value of&nbsp;<code>4<\/code>, but you are only allowed to change the values of variables, and&nbsp;<code>4<\/code>&nbsp;is not a variable. While <code>A = B<\/code> and <code>B = A<\/code> are the same in mathematics, they are different in programming.<\/p>\n<h2>Exercise<\/h2>\n<p>This is a warm-up to get you started with variables. <form class=\"pbform\" action=\"#\" id=\"pbform4\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox4'>\n<img title='You have not yet completed this problem.' src='https:\/\/olescs.hkmu.edu.hk\/python\/wp-content\/plugins\/pybox\/files\/icon.png' class='pycheck'\/><div class=\"heading\"><span class='type'>Coding Exercise: <\/span><span class='title'>Heads, Shoulders, Knees and Toes<\/span><\/div> Write a <em>code fragment<\/em> (a short part of a Python program) to count heads, shoulders, knees, and toes at a party. The grader will automatically define a variable <code>people<\/code> for you, counting the number of people at the party. Your code must define four variables, one called <code>heads<\/code>, one called <code>shoulders<\/code>, one called <code>knees<\/code>, and one called <code>toes<\/code>, equal to the number of heads, shoulders, knees, and toes in total at the party. Your program does not need to print any output. <em>The grader will select a new random value for&nbsp;<\/em><code>people<\/code><em>&nbsp;each time your code runs<\/em>. <br\/> <a class=\"hintlink\"  id=\"hintlink5\">Click here if you want a hint on getting started<\/a> <div class=\"helpOuter\" style=\"display: none;\"><div class=\"helpInner\"><div style=\"text-align: center\">You need to create an account and log in to ask a question.<\/div><\/div><\/div><div class='pyboxTextwrap pyboxCodewrap RW resizy'  style='height: 526px;'><textarea wrap='off' name='usercode4' id='usercode4'  cols=10 rows=20   class='pyboxCode RW'>\n<\/textarea><\/div>\n<div id='pbhistory4' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit4' value=' '\/><\/td>\n<td><input type='button' name='history' value=\"History\" onclick=\"historyClick(4,'1.heads')\" ><\/td>\n<td><input type='button' name='help' value=\"Help\" onclick=\"helpClick(4);\" ><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"en-US\"\/><input type=\"hidden\" id=\"inputInUse4\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"4\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"0ab421becbbbd5eb8c4ea0f455b27080\"\/>\n<div id='pbresults4' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit4\").value = \"Run program\";document.getElementById(\"inputInUse4\").value = \"N\";<\/script>\n<\/p>\n<h2>Code Scramble<\/h2>\n<p>The next item in this lesson is a new type of programming exercise, where you don't have to do any programming. We will provide you with a correct program, but the catch is that its lines have been put into a scrambled-up order. Your job is to drag-and-drop the lines to rearrange them into a correct program. <form class=\"pbform\" action=\"#\" id=\"pbform6\" method=\"POST\">\n<div class='pybox modeNeutral scramble' id='pybox6'>\n<img title='You have not yet completed this problem.' src='https:\/\/olescs.hkmu.edu.hk\/python\/wp-content\/plugins\/pybox\/files\/icon.png' class='pycheck'\/><div class=\"heading\"><span class='type'>Scramble Exercise: <\/span><span class='title'>Speed Calculator<\/span><\/div>You are in a bike race which goes up and down a hill. The grader will pre-define four variables for you: <code>uphillDistance<\/code> and <code>downhillDistance<\/code> give the distance (in km) of both parts of the race, and <code>uphillTime<\/code> and <code>downhillTime<\/code> give the time (in minutes) of how long it took you to complete each part of the race. Write a program that will print out your average speed (in km\/min) for the entire race.<br\/><em>Drag and drop with your mouse to rearrange the lines.<br\/><\/em><a class=\"hintlink\"  id=\"hintlink7\">Click for a hint if you're stuck<\/a>&nbsp;<ul class=\"pyscramble\" name=\"pyscramble\" id=\"pyscramble6\">\n <li class=\"pyscramble\">totalDistance = uphillDistance + downhillDistance<\/li>\n <li class=\"pyscramble\">print(averageSpeed)<\/li>\n <li class=\"pyscramble\">averageSpeed = totalDistance \/ totalTime<\/li>\n <li class=\"pyscramble\">totalTime = uphillTime + downhillTime<\/li>\n<\/ul>\n<input type='hidden' id='usercode6' name='usercode6'\/>\n<div id='pbhistory6' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit6' value=' '\/><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"en-US\"\/><input type=\"hidden\" id=\"inputInUse6\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"6\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"4f9f0763e7b7ffdbff048173e4313a1b\"\/>\n<div id='pbresults6' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit6\").value = \"Run program\";document.getElementById(\"inputInUse6\").value = \"N\";<\/script>\n<\/p>\n<h2>Exchange Program<\/h2>\n<p>Here is the last exercise in this lesson. <form class=\"pbform\" action=\"#\" id=\"pbform8\" method=\"POST\">\n<div class='pybox modeNeutral ' id='pybox8'>\n<img title='You have not yet completed this problem.' src='https:\/\/olescs.hkmu.edu.hk\/python\/wp-content\/plugins\/pybox\/files\/icon.png' class='pycheck'\/><div class=\"heading\"><span class='type'>Coding Exercise: <\/span><span class='title'>Exchange Program<\/span><\/div>Write a program to&nbsp;<strong>swap<\/strong> the values of two variables.&nbsp;The grader will automatically define variables&nbsp;<code>x<\/code>&nbsp;and <code>y<\/code> for you, with numerical values. You must write code that exchanges their values: the value of <code>x<\/code> after your code runs must equal the value that <code>y<\/code> had before your code ran, and the value of&nbsp;<code>y<\/code>&nbsp;after your code runs must equal the value that&nbsp;<code>x<\/code>&nbsp;had before your code ran. Your program does not need to print any output. <br\/><em>The most common solution is short, but can be hard to find. Click on each hint if you want to read it.&nbsp;<\/em> <div class=\"accordion\"> <div class='collapseContain hiding'>\n<div class='collapseHead'><span class='icon'><\/span>\nHint, part 1\n<\/div>\n<div class='collapseBody'>You do not need to use any arithmetic (<code>+-*\/<\/code>) to solve this problem. You only need to use variables and <code>=<\/code>. You can define new variables with any name, if you need to. <\/div><\/div><div class='collapseContain hiding'>\n<div class='collapseHead'><span class='icon'><\/span>\nHint, part 2\n<\/div>\n<div class='collapseBody'>We have two goals: put the original value of <code>y<\/code> into <code>x<\/code>, and put the original value of <code>x<\/code> into <code>y<\/code>. If all we wanted to do was the first goal (in other words, if we only wanted to put the value of <code>y<\/code> into <code>x<\/code>), we could use the one-line program <\/p>\n<pre>x = y<\/pre> How can we do both goals at once? <\/div><\/div><div class='collapseContain hiding'>\n<div class='collapseHead'><span class='icon'><\/span>\nHint, part 3\n<\/div>\n<div class='collapseBody'>The following program might seem promising, <\/p>\n<pre>x = y<br\/>y = x<\/pre> But there is a problem. For example, let's say that the grader starts by defining <code>x<\/code> equal to 10 and <code>y<\/code> equal to 99. If we run the two-line program above, after the first line both <code>x<\/code> and <code>y<\/code> will equal 99. The second line has no effect. <em>You can try submitting this solution to the grader to check for yourself what happens.&nbsp;<\/em>How can we keep the original value of <code>x<\/code> somewhere, in order to put it into <code>y<\/code> later? <\/div><\/div><div class='collapseContain hiding'>\n<div class='collapseHead'><span class='icon'><\/span>\nHint, part 4\n<\/div>\n<div class='collapseBody'>Your first line should be something like <code>xOriginal = x<\/code>, to store the original value of <code>x<\/code> for later. Then you can set&nbsp;<code>x = y<\/code>. Finally, set <code>y<\/code>&nbsp;equal to the original value of <code>x<\/code>.<\/div><\/div><div class='collapseContain hiding'>\n<div class='collapseHead'><span class='icon'><\/span>\nHint, part 5\n<\/div>\n<div class='collapseBody'> <a href=\"http:\/\/en.wikipedia.org\/wiki\/Swap_(computer_science)#Using_a_temporary_variable\">Click to read a wikipedia page<\/a> giving pseudocode (in a different language) for swapping. Here is a link to a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Swap_by_addition_and_subtraction#Variations\">second method<\/a>&nbsp;that uses arithmetic in a sneaky way, but it will only work with numbers and not with text.<\/div><\/div><\/div> <div class=\"helpOuter\" style=\"display: none;\"><div class=\"helpInner\"><div style=\"text-align: center\">You need to create an account and log in to ask a question.<\/div><\/div><\/div><div class='pyboxTextwrap pyboxCodewrap RW resizy'  style='height: 526px;'><textarea wrap='off' name='usercode8' id='usercode8'  cols=10 rows=20   class='pyboxCode RW'>\n<\/textarea><\/div>\n<div id='pbhistory8' class='flexcontain' style='display:none;'><\/div>\n<div class='pyboxbuttons'><table><tr>\n<td><input type='submit' name='submit' id='submit8' value=' '\/><\/td>\n<td><input type='button' name='history' value=\"History\" onclick=\"historyClick(8,'1.swap')\" ><\/td>\n<td><input type='button' name='help' value=\"Help\" onclick=\"helpClick(8);\" ><\/td>\n<\/tr><\/table><\/div>\n<input type=\"hidden\" name=\"lang\" value=\"en-US\"\/><input type=\"hidden\" id=\"inputInUse8\" name=\"inputInUse\" value=\"Y\"\/>\n<input type=\"hidden\" name=\"pyId\" value=\"8\"\/>\n<input type=\"hidden\" name=\"hash\" value=\"1782b4735370446ce3412f67529a7aee\"\/>\n<div id='pbresults8' class='pbresults'><\/div>\n<\/div>\n<\/form>\n<script type='text\/javascript'>document.getElementById(\"submit8\").value = \"Run program\";document.getElementById(\"inputInUse8\").value = \"N\";<\/script>\n Once you get this exercise correct, you are ready to move on to the next lesson. Click the <strong>Next<\/strong>&nbsp;button below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Variables act as \"storage locations\" for data in a program. They are a way of naming information for later usage. Each variable has a name; an example variable name we will use is&nbsp;myLuckyNumber. To store information in a variable, we &hellip; <a href=\"https:\/\/olescs.hkmu.edu.hk\/python\/1-variables\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-241","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/pages\/241"}],"collection":[{"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":1,"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/pages\/241\/revisions"}],"predecessor-version":[{"id":11452,"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/pages\/241\/revisions\/11452"}],"wp:attachment":[{"href":"https:\/\/olescs.hkmu.edu.hk\/python\/wp-json\/wp\/v2\/media?parent=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}