{"id":82,"date":"2021-09-23T10:20:23","date_gmt":"2021-09-23T15:20:23","guid":{"rendered":"https:\/\/sites.owu.edu\/geog-199\/?p=82"},"modified":"2021-09-23T10:20:23","modified_gmt":"2021-09-23T15:20:23","slug":"wade-chapter-4-learning-python-language-fundamentals","status":"publish","type":"post","link":"https:\/\/sites.owu.edu\/geog-293\/2021\/09\/23\/wade-chapter-4-learning-python-language-fundamentals\/","title":{"rendered":"Wade: Chapter 4: Learning Python Language Fundamentals"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Mack Wade<\/span><\/p>\n<p><span style=\"font-weight: 400\">Chapter 4: Learning Python Language Fundamentals<\/span><\/p>\n<p><span style=\"font-weight: 400\">Terms<\/span><\/p>\n<p><b>Boolean:<\/b><span style=\"font-weight: 400\"> denoting a system of algebraic notation used to represent logical propositions, especially in computing and electronics.<\/span><\/p>\n<p><b>Boolean Expression:<\/b> <span style=\"font-weight: 400\">In computer science, a Boolean expression is an expression used in programming languages that produces a Boolean value when evaluated. A Boolean value is either true or false.<\/span><\/p>\n<p><b>Boolean Logic:<\/b> <span style=\"font-weight: 400\">In mathematics and mathematical logic, Boolean algebra is the branch of algebra in which the values of the variables are the truth values true and false, usually denoted 1 and 0, respectively.<\/span><\/p>\n<p><b>Boolean OPerator:<\/b> <span style=\"font-weight: 400\">Boolean Operators are simple words (AND, OR, NOT or AND NOT) <\/span><span style=\"font-weight: 400\">used as conjunctions to combine or exclude keywords in a search<\/span><span style=\"font-weight: 400\">, resulting in more focused and productive results. This should save time and effort by eliminating inappropriate hits that must be scanned before discarding.<\/span><\/p>\n<p><b>Built in Operator:<\/b> <span style=\"font-weight: 400\">These operators are used to <\/span><span style=\"font-weight: 400\">perform arithmetic computations on their operands<\/span><span style=\"font-weight: 400\">. This operator returns the result of adding the two operands (operand1 and operand2).<\/span><\/p>\n<p><b>Camel Case:<\/b> <span style=\"font-weight: 400\">Camel case is the practice of writing phrases without spaces or punctuation, indicating the separation of words with a single capitalized letter, and the first word starting with either case. Common examples include &#8220;iPhone&#8221; and &#8220;eBay&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400\">Casting: <\/span><span style=\"font-weight: 400\">Casting is <\/span><span style=\"font-weight: 400\">when you convert a variable value from one type to another<\/span><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><b>Comparison Operator:<\/b> <span style=\"font-weight: 400\">Comparison operators \u2014 operators <\/span><span style=\"font-weight: 400\">that compare values and return true or false<\/span><span style=\"font-weight: 400\"> . The operators include: &gt; , &lt; , &gt;= , &lt;= , === , and !==\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Condition: The boolean expression in a conditional statement that determines which branch is executed<\/span><span style=\"font-weight: 400\">.\u00a0<\/span><\/p>\n<p><b>Docstring: <\/b><span style=\"font-weight: 400\">a string literal specified in source code<\/span><span style=\"font-weight: 400\"> that is used, like a comment, to document a specific segment of code<\/span><\/p>\n<p><b>Dot Notation<\/b><span style=\"font-weight: 400\">: <\/span><span style=\"font-weight: 400\">You can access properties on an object by specifying the name of the object, <\/span><span style=\"font-weight: 400\">followed by a dot (period) followed by the property name<\/span><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><b>Escape character:<\/b><span style=\"font-weight: 400\"> a character that invokes an alternative interpretation on<\/span><span style=\"font-weight: 400\"> the following characters in a character sequence.<\/span><\/p>\n<p><b>Float<\/b><span style=\"font-weight: 400\">: a data type composed of a number that is not an integer<\/span><span style=\"font-weight: 400\">, because it includes a fraction represented in decimal format.<\/span><\/p>\n<p><b>Floor Division:<\/b><span style=\"font-weight: 400\"> a normal division operation except that it returns the largest possible integer<\/span><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><b>F-String:<\/b><span style=\"font-weight: 400\"> provide a way to embed expressions inside string literals<\/span><span style=\"font-weight: 400\">, using a minimal syntax<\/span><\/p>\n<p><span style=\"font-weight: 400\">Immutable: <\/span><span style=\"font-weight: 400\">unchanging over time or unable to be changed.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Indexing: a way to refer the individual items within an iterable by its position<\/span><\/p>\n<p><b>Modulus:<\/b> <span style=\"font-weight: 400\">The Python modulo operator <\/span><span style=\"font-weight: 400\">calculates the remainder of dividing two values<\/span><span style=\"font-weight: 400\">. This operator is represented by the percentage sign (%). The syntax for the modulo operator is: number1 % number2. The first number is divided by the second then the remainder is returned<\/span><\/p>\n<p><b>Parameter: <\/b><span style=\"font-weight: 400\">he variable listed inside the parentheses in the function definition<\/span><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><b>Sentry Variable:<\/b><span style=\"font-weight: 400\"> a variable used in the condition<\/span><span style=\"font-weight: 400\"> and it is compared to some other value or values<\/span><\/p>\n<p><b>Snake Case:<\/b> <span style=\"font-weight: 400\">refers to the style of writing in which each space is replaced by an underscore character, and the first letter of each word written in lowercase. It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames.<\/span><\/p>\n<p><b>String:<\/b><span style=\"font-weight: 400\"> an immutable sequence data type<\/span><span style=\"font-weight: 400\">. It is the sequence of Unicode characters wrapped inside single, double, or triple quotes<\/span><\/p>\n<p><b>True Division:<\/b> <span style=\"font-weight: 400\">When <\/span><span style=\"font-weight: 400\">dividing something by 1, the answer will always be the original number<\/span><span style=\"font-weight: 400\">.\u00a0<\/span><\/p>\n<p><b>Unicode: <\/b><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">Unicode, formally the Unicode Standard, is an information technology standard for the consistent encoding, representation, and handling of text expressed in most of the world&#8217;s writing systems.<\/span><\/p>\n<p><b>Whitespace:<\/b><span style=\"font-weight: 400\"> characters which are used for spacing, and have an &#8220;empty&#8221; representation<\/span><span style=\"font-weight: 400\">. In the context of python, it means tabs and spaces<\/span><\/p>\n<p><b>Zero-Based Language:<\/b> <span style=\"font-weight: 400\">Zero-based numbering is a way of numbering in which the initial element of a sequence is assigned the index 0, rather than the index 1 as is typical in everyday non-mathematical or non-programming circumstances<\/span><\/p>\n<p><b>Review Questions<\/b><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">What are the main data types in Python?<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The most common ones are <\/span><span style=\"font-weight: 400\">float (floating point), int (integer)<\/span><span style=\"font-weight: 400\">, str (string), bool (Boolean), list, and dict (dictionary). float &#8211; used for real numbers. int &#8211; used for integers.\u00a0<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">What are unicode strings?<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A Unicode string is <\/span><span style=\"font-weight: 400\">a sequence of zero or more code points<\/span><span style=\"font-weight: 400\">.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">What is dot notation?<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In general, dot notation <\/span><span style=\"font-weight: 400\">tells Python to look inside the space that is before the dot for code to execute<\/span><span style=\"font-weight: 400\">. You can use dot notation to access the specific version of a certain function that is defined in a different class or a different module.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Name three methods of string objects in Python.<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The static method, the class method, and the instance method.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">What are some of the key similarities and differences between lists and tuples in python.<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">list and tuple are a <\/span><span style=\"font-weight: 400\">class of data structure that can store one or more objects or values<\/span><span style=\"font-weight: 400\">. A list is used to store multiple items in one variable and can be created using square brackets. Similarly, tuples also can store multiple items in a single variable and can be declared using parentheses.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Describe the use of Boolean expressions to evaluate a condition.<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A Boolean expression is a logical statement that is either TRUE or FALSE . Boolean expressions <\/span><span style=\"font-weight: 400\">can compare data of any type as long as both parts of the expression <\/span><span style=\"font-weight: 400\">have the same basic data type. You can test data to see if it is equal to, greater than, or less than other data.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Describe the steps to create a dictionary and add new items to the dictionary.<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A Dictionary can be created by <\/span><span style=\"font-weight: 400\">placing a sequence of elements within curly {} braces, separated by &#8216;comma&#8217;<\/span><span style=\"font-weight: 400\">. Dictionary holds a pair of values, one being the Key and the other corresponding pair element being its Key:value.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Describe how branching is implemented in Python code.<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Branching statements in Python are <\/span><span style=\"font-weight: 400\">used to change the normal flow of execution based on some condition<\/span><span style=\"font-weight: 400\">. The return branching statement is used to explicitly return from a method. A break branching statement is used to break the loop and transfer control to the line immediately outside of loop.\u00a0<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">What is a compound statement in Python?\u00a0<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Compound statements are made up <\/span><span style=\"font-weight: 400\">of two or more program statements that are executed together<\/span><span style=\"font-weight: 400\">. This usually occurs while handling conditions wherein a series of statements are executed when a TRUE or FALSE is evaluated. Compound statements can also be executed within a loop.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Describe the two main looping structures in Python.<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\u201cFor\u201d and \u201cWhile\u201d <\/span><span style=\"font-weight: 400\">For loops can iterate over a sequence of numbers using the &#8220;range&#8221; and &#8220;xrange&#8221; functions. The difference between range and xrange is that the range function returns a new list with numbers of that specified range, whereas xrange returns an iterator, which is more efficient.For loops can iterate over a sequence of numbers using the &#8220;range&#8221; and &#8220;xrange&#8221; functions. The difference between range and xrange is that the range function returns a new list with numbers of that specified range, whereas xrange returns an iterator, which is more efficient.<\/span><\/li>\n<\/ol>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Why should you add comments to your scripts?<\/span>\n<ol style=\"list-style-type: lower-alpha\">\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Using comments in any script or code is <\/span><span style=\"font-weight: 400\">very important to make the script more readable<\/span><span style=\"font-weight: 400\">. Comments work as a documentation for the script. The reader can easily understand each step of the script if it is properly commented by the author.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Mack Wade Chapter 4: Learning Python Language Fundamentals Terms Boolean: denoting a system of algebraic notation used to represent logical propositions, especially in computing and electronics. Boolean Expression: In computer science, a Boolean expression is an expression used in programming <span class=\"readmore\"><a href=\"https:\/\/sites.owu.edu\/geog-293\/2021\/09\/23\/wade-chapter-4-learning-python-language-fundamentals\/\">Continue Reading<\/a><\/span><\/p>\n","protected":false},"author":1413,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/users\/1413"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":1,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":83,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/posts\/82\/revisions\/83"}],"wp:attachment":[{"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.owu.edu\/geog-293\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}