Python With Spyder 3: Functions and Scoping

This is the 3rd in a series of videos providing a tutorial on Python 2.7 using Anaconda Python and the Spyder IDE. Click here to go to a “home page” for the video series.

The topics covered in this video are defining functions and the scope of variables.

The video is about 22 minutes long.

PWS3-DSSThumb

Next Video: Strings, Indexing, and Slicing

Video Index: Functions and Scoping

Click on the topics below to jump to that location in the video.

Time Topic
00:00 Introduction
00:28 Move console to expose Editor window
01:10 Define simple function – “def” statement
01:36 End def statement with colon (“:”)
01:52 Indentation of function code
02:23 “return” statement
02:35 End function code block with blank line
03:07 Run simple function example with F9
03:41 Local variables
06:04 Variable explorer window
06:10 Global variables
06:41 Restart Ipython console (kernal)
07:02 Local variables do not exist at global level
08:28 Use global variables inside functions
09:42 Change global variables inside functions
11:10 “global” statement inside function
12:13 Multiple function arguments
14:28 Missing argument error
15:11 Default argument values
20:44 Summary

Next Video: Strings, Indexing, and Slicing

Python With Spyder 2: Basic Arithmetic and Variable Assignment

This is the 2nd in a series of videos providing a tutorial on Python 2.7 using Anaconda Python and the Spyder IDE. Click here to go to a “home page” for the video series.

This video discusses basic arithmetic in Python (basic math operations), variable assignment, transcendental functions (like exp) using the math module, and logicals (including comparison).

The video is about 24 minutes long.

PWS2-DSSThumb

Next Video: Functions and Scoping

Video Index: Basic Arithmetic and Variable Assignment

Click on the topics below to jump to that location in the video.

Time Topic
00:00 Introduction
00:35 Launching the Spyder IDE
01:32 Making the iPython console large
01:49 Showing the Variable Explorer window
02:05 Basic Arithmetic Introduction
02:17 Addition Example
02:22 Multiplication Example
02:27 Order of precidence
02:29 Power (exponentiation) operator
03:17 Caclulating roots using the power operator
03:34 Integer division (unexpected behavior)
04:18 Making floating point numbers using the decimal point
04:47 Types of numbers with “type()”
05:12 Conversion of integers to floting point numbers in mixed expressions
05:43 Advice: Write math expressions in decimals
06:19 Summary of arithmetic in Python
06:40 Assigning variables
06:54 Variables are shown in the Variable Explorer window
07:17 Print the value of a variable
07:34 Print the value of a variable with the “print” statement
07:42 Changing the value of a variable with the Variable Explorer window
08:19 Arithmentic with variables
08:54 Types of variables
09:02 Convert a variable to a floating point number with “float()”
10:07 Transcendental math functions not a part of basic Python
10:41 Importing the “math” module
11:06 Using math functions
11:32 Math constants and the math constant e
11:40 Clear console window with cntr-L
11:49 The math constant pi
11:58 cosine and sine
12:15 Summary of the basic use of trascendental math functions in Python
12:28 “Directory” of the math object using the function “dir()”
13:06 “log()” is the natural logarithm; tesing the log() function to verify what it does.
14:05 Log to the base 10 with “log10()”; testing the log10() function to verify what it does.
14:31 Introduction to logicals
14:40 “True”
14:55 “False”
15:04 Opertations with logicals
15:16 “or”
15:34 “and”
15:47 grouping and “not” (the complement)
16:24 Comparisons: greater than (“>”) and less than (“<")
16:40 Equality (“==”)
17:23 Greater than or equals (“>=”) and less than or equals (“<=")
17:41 Not equals (“!=”)
18:00 Summary of logicals
18:52 Getting information and documentation about Python
19:01 The best way to get information using a search engine such as Google
19:16 Finding Python tutorials
19:24 The python.org web site
19:35 The Python Tutorial at Python.org
19:59 Finding more specific Python information
21:34 The stackoverflow.com web site
22:03 Information about determining the type of an object at stackoverflow.com
22:12 Using “isinstance()”
23:18 Summary of getting information about Python
23:50 Video conclusion

Next Video: Functions and Scoping

Python with Spyder 1: First Steps

This video is the first in my series of videos providing an introduction to Python 2.7 using Anaconda Python and the Spyder IDE. Click here to go to a “home page” for the video series.

The video begins by showing how to make sure that Anaconda Python is up to date (turn off your antivirus software during this step). Next, the video shows how to launch the Spyder IDE, set the workspace and project for the first time, and the main windows of the Spyder IDE. The traditional “Hello, World!” program is created and run.

Note: Turn off your antivirus software when running the “conda” command to update the software as described in the video. If your antivirus software quarantines some of the files being installed, it may mess up your Anaconda installation and be very difficult to undo without reinstalling Anaconda Python from scratch!<.p>

The video is about 16 minutes long.

PWS1-DSSThumb

Next Video: Basic Arithmetic

Video Index: First Steps

Click on the topics below to jump to that location in the video.

Time Topic
00:00 Title
00:05 Introduction
01:18 Using the Windows Button
01:53 The Windows 8 Start Screen
02:21 List of Apps in Windows 8 and the Anaconda Python Programs
03:08 Using the Windows Button (and search) to launch a program
03:25 Launching the Anaconda Command Prompt
04:05 The “conda” program and updating Anaconda Python
05:27 What to do if the update fails (use the -f option)
05:54 What to do if the “conda” program fails – reinstall with virus software off
07:16 Launching the Spyder IDE
08:08 Setting up the Spyder Workspace
08:45 Python’s default folders (Python Scripts and IPython Notebooks)
09:33 Creating a project in Spyder
10:22 The Ipython Console window
10:52 The “Hello, World!” program
11:30 The Editor window
12:26 Executing a line or lines of python code from the editor window
13:48 The Information window
14:13 The Project Explorer Window (revisited)
14:45 Summary

Next Video: Basic Arithmetic