Difference between revisions of "Python Keywords, Concepts, Functions"

From Computer Science
Jump to: navigation, search
(Python Keywords)
(Python Keywords)
Line 3: Line 3:
 
Following are terse descriptions for Python3 keywords and commonly used functions.  For more information, see [https://www.w3schools.com/python/python_ref_keywords.asp w3schools] for a bit more explanation and [https://docs.python.org/3/reference/ python.org] for the language reference.
 
Following are terse descriptions for Python3 keywords and commonly used functions.  For more information, see [https://www.w3schools.com/python/python_ref_keywords.asp w3schools] for a bit more explanation and [https://docs.python.org/3/reference/ python.org] for the language reference.
  
=Python Keywords=
+
=Keywords=
 +
The following are heavily used in all levels of Python programming.  This is a minimum set of keywords to know how to use.
 
* <code>break</code> - exit the current loop
 
* <code>break</code> - exit the current loop
 +
* <code>continue</code> - in a loop, go to next iteration of the loop
 
* <code>print</code> - function to write to the screen
 
* <code>print</code> - function to write to the screen
* <code></code> - Text data type
+
* <code>is</code> - determine whether two objects are the same object(not just value)
* <code></code> - Function to convert a string to an integer
+
* <code>import, from</code> - to load a module
* <code></code> - Function to generate a sequence of numbers
+
* <code>def</code> - declare a function
* <code></code> - Determine whether two objects are the same object(not just value)
+
* <code>while</code> - loop with only condition
* <code></code> - To load a module
+
* <code>if, elif, else</code> - conditional statements (three keywords)
* <code></code> - Declare a function
+
* <code>for</code> - loop with that iterates through a list
* <code></code> - Loop with only condition
+
* <code>return</code> - keyword to send a value back from a function
* <code></code> - Conditional statements (three keywords)
+
* <code>and</code> - boolean operator, True only if both sides are True
* <code></code> - Function to get the length of a string
+
* <code>or</code> - boolean operator, True if either side is True
* <code></code> - Loop with that iterates through a list
+
* <code>not</code> - boolean operator, negates
* <code></code> - Keyword to send a value back from a function
+
* <code>True, False</code> - boolean values (two keywords)
* <code></code> - Boolean operator, True only if both sides are True
+
* <code>del</code> - remove from a list by position
* <code></code> - Boolean operator, True if either side is True
+
* <code>try, except</code> - handle an exception, basic use (2 keywords)
* <code></code> - Boolean operator, negates
+
* <code>raise, assert</code> - raise/indicate an exception (2 keywords)
* <code></code> - Boolean values (two keywords)
+
* <code>in</code> - test if something is inside of a list/string/tuple/dictionary
* <code></code> - Remove from a list by position
+
* <code>None</code> - special value for a variable that has no value
* <code></code> - Handle an exception (2 keywords)
+
* <code>pass</code> - empty statement that does not do anything
* <code></code> - Test if something is inside of a list/string/tuple/dictionary
 
* <code></code> - Special value for a variable that has no value
 
  
 +
==More Keywords==
 +
These keywords are often not introduced or heavily used until the second Python course.
 +
* <code>as, finally, with, else</code> - exception handling, more keywords (4 keywords)
 +
* <code>class</code> - defining new class data type (for object-oriented programming)
 +
* <code>lambda</code> - create unnamed / anonymous function
 +
* <code>global, nonlocal</code> - access variables outside of current scope (2 keywords)
 +
* <code>async, await</code> - for writing asynchronous code with asynchio package (2 keywords)
 +
* <code>yield</code> - for creating generator functions
 +
 +
=Concepts=
 +
These are terms that we use to describe programs.  These are terms that have a precise meaning when talking about programs.
 +
* <code>string</code> - text data type
 
* <code>boolean</code> - data type for True and False
 
* <code>boolean</code> - data type for True and False
  
 
=Python Commonly Used Functions=
 
=Python Commonly Used Functions=

Revision as of 21:20, 31 December 2019

See also Python Programming - Getting Started

Following are terse descriptions for Python3 keywords and commonly used functions. For more information, see w3schools for a bit more explanation and python.org for the language reference.

Keywords

The following are heavily used in all levels of Python programming. This is a minimum set of keywords to know how to use.

  • break - exit the current loop
  • continue - in a loop, go to next iteration of the loop
  • print - function to write to the screen
  • is - determine whether two objects are the same object(not just value)
  • import, from - to load a module
  • def - declare a function
  • while - loop with only condition
  • if, elif, else - conditional statements (three keywords)
  • for - loop with that iterates through a list
  • return - keyword to send a value back from a function
  • and - boolean operator, True only if both sides are True
  • or - boolean operator, True if either side is True
  • not - boolean operator, negates
  • True, False - boolean values (two keywords)
  • del - remove from a list by position
  • try, except - handle an exception, basic use (2 keywords)
  • raise, assert - raise/indicate an exception (2 keywords)
  • in - test if something is inside of a list/string/tuple/dictionary
  • None - special value for a variable that has no value
  • pass - empty statement that does not do anything

More Keywords

These keywords are often not introduced or heavily used until the second Python course.

  • as, finally, with, else - exception handling, more keywords (4 keywords)
  • class - defining new class data type (for object-oriented programming)
  • lambda - create unnamed / anonymous function
  • global, nonlocal - access variables outside of current scope (2 keywords)
  • async, await - for writing asynchronous code with asynchio package (2 keywords)
  • yield - for creating generator functions

Concepts

These are terms that we use to describe programs. These are terms that have a precise meaning when talking about programs.

  • string - text data type
  • boolean - data type for True and False

Python Commonly Used Functions