{"id":2094,"date":"2024-03-26T15:38:19","date_gmt":"2024-03-26T15:38:19","guid":{"rendered":"https:\/\/www.tutavo.com\/Kachina\/?p=2094"},"modified":"2024-03-26T16:05:00","modified_gmt":"2024-03-26T16:05:00","slug":"python-key-words-and-phrases","status":"publish","type":"post","link":"https:\/\/www.tutavo.com\/Kachina\/python-key-words-and-phrases\/","title":{"rendered":"Python: Key Words and Phrases"},"content":{"rendered":"<p><a href=\"https:\/\/www.w3schools.com\/python\/python_reference.asp\"><span style=\"font-size: 24pt;\">Python Overview<\/span><\/a><\/p>\n<table class=\"ws-table-all notranslate\">\n<tbody>\n<tr>\n<th>Keyword<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_and.asp\">and<\/a><\/td>\n<td>A logical operator<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_as.asp\">as<\/a><\/td>\n<td>To create an alias<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_assert.asp\">assert<\/a><\/td>\n<td>For debugging<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_break.asp\">break<\/a><\/td>\n<td>To break out of a loop<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_class.asp\">class<\/a><\/td>\n<td>To define a class<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_continue.asp\">continue<\/a><\/td>\n<td>To continue to the next iteration of a loop<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_def.asp\">def<\/a><\/td>\n<td>To define a function<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_del.asp\">del<\/a><\/td>\n<td>To delete an object<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_elif.asp\">elif<\/a><\/td>\n<td>Used in conditional statements, same as else if<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_else.asp\">else<\/a><\/td>\n<td>Used in conditional statements<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_except.asp\">except<\/a><\/td>\n<td>Used with exceptions, what to do when an exception occurs<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_false.asp\">False<\/a><\/td>\n<td>Boolean value, result of comparison operations<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_finally.asp\">finally<\/a><\/td>\n<td>Used with exceptions, a block of code that will be executed no matter if there is an exception or not<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_for.asp\">for<\/a><\/td>\n<td>To create a for loop<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_from.asp\">from<\/a><\/td>\n<td>To import specific parts of a module<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_global.asp\">global<\/a><\/td>\n<td>To declare a global variable<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_if.asp\">if<\/a><\/td>\n<td>To make a conditional statement<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_import.asp\">import<\/a><\/td>\n<td>To import a module<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_in.asp\">in<\/a><\/td>\n<td>To check if a value is present in a list, tuple, etc.<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_is.asp\">is<\/a><\/td>\n<td>To test if two variables are equal<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_lambda.asp\">lambda<\/a><\/td>\n<td>To create an anonymous function<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_none.asp\">None<\/a><\/td>\n<td>Represents a null value<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_nonlocal.asp\">nonlocal<\/a><\/td>\n<td>To declare a non-local variable<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_not.asp\">not<\/a><\/td>\n<td>A logical operator<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_or.asp\">or<\/a><\/td>\n<td>A logical operator<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_pass.asp\">pass<\/a><\/td>\n<td>A null statement, a statement that will do nothing<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_raise.asp\">raise<\/a><\/td>\n<td>To raise an exception<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_return.asp\">return<\/a><\/td>\n<td>To exit a function and return a value<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_true.asp\">True<\/a><\/td>\n<td>Boolean value, result of comparison operations<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_try.asp\">try<\/a><\/td>\n<td>To make a try&#8230;except statement<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_while.asp\">while<\/a><\/td>\n<td>To create a while loop<\/td>\n<\/tr>\n<tr>\n<td>with<\/td>\n<td>Used to simplify exception handling<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.w3schools.com\/python\/ref_keyword_yield.asp\">yield<\/a><\/td>\n<td>To return a list of values from a generator<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2>Built-in Exceptions<\/h2>\n<p>The table below shows built-in exceptions that are usually raised in Python:<\/p>\n<table class=\"ws-table-all notranslate\">\n<tbody>\n<tr>\n<th>Exception<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>ArithmeticError<\/td>\n<td>Raised when an error occurs in numeric calculations<\/td>\n<\/tr>\n<tr>\n<td>AssertionError<\/td>\n<td>Raised when an assert statement fails<\/td>\n<\/tr>\n<tr>\n<td>AttributeError<\/td>\n<td>Raised when attribute reference or assignment fails<\/td>\n<\/tr>\n<tr>\n<td>Exception<\/td>\n<td>Base class for all exceptions<\/td>\n<\/tr>\n<tr>\n<td>EOFError<\/td>\n<td>Raised when the input() method hits an &#8220;end of file&#8221; condition (EOF)<\/td>\n<\/tr>\n<tr>\n<td>FloatingPointError<\/td>\n<td>Raised when a floating point calculation fails<\/td>\n<\/tr>\n<tr>\n<td>GeneratorExit<\/td>\n<td>Raised when a generator is closed (with the close() method)<\/td>\n<\/tr>\n<tr>\n<td>ImportError<\/td>\n<td>Raised when an imported module does not exist<\/td>\n<\/tr>\n<tr>\n<td>IndentationError<\/td>\n<td>Raised when indentation is not correct<\/td>\n<\/tr>\n<tr>\n<td>IndexError<\/td>\n<td>Raised when an index of a sequence does not exist<\/td>\n<\/tr>\n<tr>\n<td>KeyError<\/td>\n<td>Raised when a key does not exist in a dictionary<\/td>\n<\/tr>\n<tr>\n<td>KeyboardInterrupt<\/td>\n<td>Raised when the user presses Ctrl+c, Ctrl+z or Delete<\/td>\n<\/tr>\n<tr>\n<td>LookupError<\/td>\n<td>Raised when errors raised cant be found<\/td>\n<\/tr>\n<tr>\n<td>MemoryError<\/td>\n<td>Raised when a program runs out of memory<\/td>\n<\/tr>\n<tr>\n<td>NameError<\/td>\n<td>Raised when a variable does not exist<\/td>\n<\/tr>\n<tr>\n<td>NotImplementedError<\/td>\n<td>Raised when an abstract method requires an inherited class to override the method<\/td>\n<\/tr>\n<tr>\n<td>OSError<\/td>\n<td>Raised when a system related operation causes an error<\/td>\n<\/tr>\n<tr>\n<td>OverflowError<\/td>\n<td>Raised when the result of a numeric calculation is too large<\/td>\n<\/tr>\n<tr>\n<td>ReferenceError<\/td>\n<td>Raised when a weak reference object does not exist<\/td>\n<\/tr>\n<tr>\n<td>RuntimeError<\/td>\n<td>Raised when an error occurs that do not belong to any specific exceptions<\/td>\n<\/tr>\n<tr>\n<td>StopIteration<\/td>\n<td>Raised when the next() method of an iterator has no further values<\/td>\n<\/tr>\n<tr>\n<td>SyntaxError<\/td>\n<td>Raised when a syntax error occurs<\/td>\n<\/tr>\n<tr>\n<td>TabError<\/td>\n<td>Raised when indentation consists of tabs or spaces<\/td>\n<\/tr>\n<tr>\n<td>SystemError<\/td>\n<td>Raised when a system error occurs<\/td>\n<\/tr>\n<tr>\n<td>SystemExit<\/td>\n<td>Raised when the sys.exit() function is called<\/td>\n<\/tr>\n<tr>\n<td>TypeError<\/td>\n<td>Raised when two different types are combined<\/td>\n<\/tr>\n<tr>\n<td>UnboundLocalError<\/td>\n<td>Raised when a local variable is referenced before assignment<\/td>\n<\/tr>\n<tr>\n<td>UnicodeError<\/td>\n<td>Raised when a unicode problem occurs<\/td>\n<\/tr>\n<tr>\n<td>UnicodeEncodeError<\/td>\n<td>Raised when a unicode encoding problem occurs<\/td>\n<\/tr>\n<tr>\n<td>UnicodeDecodeError<\/td>\n<td>Raised when a unicode decoding problem occurs<\/td>\n<\/tr>\n<tr>\n<td>UnicodeTranslateError<\/td>\n<td>Raised when a unicode translation problem occurs<\/td>\n<\/tr>\n<tr>\n<td>ValueError<\/td>\n<td>Raised when there is a wrong value in a specified data type<\/td>\n<\/tr>\n<tr>\n<td>ZeroDivisionError<\/td>\n<td>Raised when the second operator in a division is zero<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2>Built-in Exceptions<\/h2>\n<p>https:\/\/www.w3schools.com\/python\/python_ref_exceptions.asp<\/p>\n<p>https:\/\/www.w3schools.com\/python\/python_ref_glossary.asp<\/p>\n<p>The table below shows built-in exceptions that are usually raised in Python:<\/p>\n<table class=\"ws-table-all notranslate\">\n<tbody>\n<tr>\n<th>Exception<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>ArithmeticError<\/td>\n<td>Raised when an error occurs in numeric calculations<\/td>\n<\/tr>\n<tr>\n<td>AssertionError<\/td>\n<td>Raised when an assert statement fails<\/td>\n<\/tr>\n<tr>\n<td>AttributeError<\/td>\n<td>Raised when attribute reference or assignment fails<\/td>\n<\/tr>\n<tr>\n<td>Exception<\/td>\n<td>Base class for all exceptions<\/td>\n<\/tr>\n<tr>\n<td>EOFError<\/td>\n<td>Raised when the input() method hits an &#8220;end of file&#8221; condition (EOF)<\/td>\n<\/tr>\n<tr>\n<td>FloatingPointError<\/td>\n<td>Raised when a floating point calculation fails<\/td>\n<\/tr>\n<tr>\n<td>GeneratorExit<\/td>\n<td>Raised when a generator is closed (with the close() method)<\/td>\n<\/tr>\n<tr>\n<td>ImportError<\/td>\n<td>Raised when an imported module does not exist<\/td>\n<\/tr>\n<tr>\n<td>IndentationError<\/td>\n<td>Raised when indentation is not correct<\/td>\n<\/tr>\n<tr>\n<td>IndexError<\/td>\n<td>Raised when an index of a sequence does not exist<\/td>\n<\/tr>\n<tr>\n<td>KeyError<\/td>\n<td>Raised when a key does not exist in a dictionary<\/td>\n<\/tr>\n<tr>\n<td>KeyboardInterrupt<\/td>\n<td>Raised when the user presses Ctrl+c, Ctrl+z or Delete<\/td>\n<\/tr>\n<tr>\n<td>LookupError<\/td>\n<td>Raised when errors raised cant be found<\/td>\n<\/tr>\n<tr>\n<td>MemoryError<\/td>\n<td>Raised when a program runs out of memory<\/td>\n<\/tr>\n<tr>\n<td>NameError<\/td>\n<td>Raised when a variable does not exist<\/td>\n<\/tr>\n<tr>\n<td>NotImplementedError<\/td>\n<td>Raised when an abstract method requires an inherited class to override the method<\/td>\n<\/tr>\n<tr>\n<td>OSError<\/td>\n<td>Raised when a system related operation causes an error<\/td>\n<\/tr>\n<tr>\n<td>OverflowError<\/td>\n<td>Raised when the result of a numeric calculation is too large<\/td>\n<\/tr>\n<tr>\n<td>ReferenceError<\/td>\n<td>Raised when a weak reference object does not exist<\/td>\n<\/tr>\n<tr>\n<td>RuntimeError<\/td>\n<td>Raised when an error occurs that do not belong to any specific exceptions<\/td>\n<\/tr>\n<tr>\n<td>StopIteration<\/td>\n<td>Raised when the next() method of an iterator has no further values<\/td>\n<\/tr>\n<tr>\n<td>SyntaxError<\/td>\n<td>Raised when a syntax error occurs<\/td>\n<\/tr>\n<tr>\n<td>TabError<\/td>\n<td>Raised when indentation consists of tabs or spaces<\/td>\n<\/tr>\n<tr>\n<td>SystemError<\/td>\n<td>Raised when a system error occurs<\/td>\n<\/tr>\n<tr>\n<td>SystemExit<\/td>\n<td>Raised when the sys.exit() function is called<\/td>\n<\/tr>\n<tr>\n<td>TypeError<\/td>\n<td>Raised when two different types are combined<\/td>\n<\/tr>\n<tr>\n<td>UnboundLocalError<\/td>\n<td>Raised when a local variable is referenced before assignment<\/td>\n<\/tr>\n<tr>\n<td>UnicodeError<\/td>\n<td>Raised when a unicode problem occurs<\/td>\n<\/tr>\n<tr>\n<td>UnicodeEncodeError<\/td>\n<td>Raised when a unicode encoding problem occurs<\/td>\n<\/tr>\n<tr>\n<td>UnicodeDecodeError<\/td>\n<td>Raised when a unicode decoding problem occurs<\/td>\n<\/tr>\n<tr>\n<td>UnicodeTranslateError<\/td>\n<td>Raised when a unicode translation problem occurs<\/td>\n<\/tr>\n<tr>\n<td>ValueError<\/td>\n<td>Raised when there is a wrong value in a specified data type<\/td>\n<\/tr>\n<tr>\n<td>ZeroDivisionError<\/td>\n<td>Raised when the second operator in a division is zero<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Python Overview Keyword Description and A logical operator as To create an alias assert For debugging break To break out of a loop class To define a class continue To continue to the next iteration of a loop def To define a function del To delete an object elif Used in conditional statements, same as &hellip; <a href=\"https:\/\/www.tutavo.com\/Kachina\/python-key-words-and-phrases\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Python: Key Words and Phrases&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-2094","post","type-post","status-publish","format-standard","hentry","category-educational"],"_links":{"self":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts\/2094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/comments?post=2094"}],"version-history":[{"count":3,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts\/2094\/revisions"}],"predecessor-version":[{"id":2097,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/posts\/2094\/revisions\/2097"}],"wp:attachment":[{"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/media?parent=2094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/categories?post=2094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tutavo.com\/Kachina\/wp-json\/wp\/v2\/tags?post=2094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}