<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.ccn.ucla.edu/wiki/index.php?action=history&amp;feed=atom&amp;title=Scripting_Basics%3A_Python</id>
	<title>Scripting Basics: Python - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.ccn.ucla.edu/wiki/index.php?action=history&amp;feed=atom&amp;title=Scripting_Basics%3A_Python"/>
	<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Scripting_Basics:_Python&amp;action=history"/>
	<updated>2026-04-11T20:03:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Scripting_Basics:_Python&amp;diff=1220&amp;oldid=prev</id>
		<title>Ccn admin: 14 revisions</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Scripting_Basics:_Python&amp;diff=1220&amp;oldid=prev"/>
		<updated>2014-01-16T03:42:30Z</updated>

		<summary type="html">&lt;p&gt;14 revisions&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Work in Progress&lt;br /&gt;
&lt;br /&gt;
 This walk through is based on the [http://www.diveintopython.org/toc/index.html Dive Into Python] free online book. &lt;br /&gt;
 Corresponding chapters should be read prior to each example section. The purpose of this page is not to reinvent or &lt;br /&gt;
 regurgitate the topics covered in each chapter, but to extend the content with examples that fMRI researchers face &lt;br /&gt;
 on a daily basis.&lt;br /&gt;
&lt;br /&gt;
=Class Prerequisites=&lt;br /&gt;
This course assumes a basic familiarity with programming principles such as&lt;br /&gt;
* functions/methods/subroutines&lt;br /&gt;
* an understanding of control structures such as loops, conditionals, and I/O&lt;br /&gt;
* understanding of basic datatypes, e.g. string, array, etc&lt;br /&gt;
&lt;br /&gt;
All of these topics are covered in any 101 programming course available at this or other education institutes. Other sources for beginner programming principles are the [http://search.oreilly.com/?i=1&amp;amp;page=2&amp;amp;q=head+first&amp;amp;u1=q O&amp;#039;reilly Head First] series of books, the [http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&amp;amp;field-keywords=sam%27s+teach+yourself&amp;amp;x=0&amp;amp;y=0 Sam&amp;#039;s Teach Yourself] series, and of course [http://www.google.com Google].&lt;br /&gt;
&lt;br /&gt;
If you decide to forgo a formal class, it&amp;#039;s highly recommended that one focus on books for either Python (of course!), C/C++, or matlab as these are the languages you are most likely to encounter during your career as a NeuroImaging Scientist Extraordinaire.&lt;br /&gt;
&lt;br /&gt;
=General &amp;quot;Good Practice&amp;quot; Tips=&lt;br /&gt;
==Type out all the examples==&lt;br /&gt;
Yes, it may seem bothersome. But typing out all the examples manually helps in the memory encoding process. If you just glance at the examples, then cut and paste you&amp;#039;ll find yourself quickly becoming lost.&lt;br /&gt;
&lt;br /&gt;
==Use a programming oriented text editor==&lt;br /&gt;
Programming oriented text editors have features like syntax highlighting and auto-indenting. These are &amp;lt;i&amp;gt;essential&amp;lt;/i&amp;gt; to generating bug free code and making the learning experience as pain free as possible. For a perfunctory discussion of various such editors, please see [[New_to_the_Lab]] wiki section.&lt;br /&gt;
&lt;br /&gt;
==Read everything in a section, then go back and follow instructions to the letter==&lt;br /&gt;
Again, sometimes boring but essential to successful completion of the sections. It&amp;#039;s very tempting at times to skim through steps or jump ahead. If something isn&amp;#039;t working for you, go back over the instructions to make sure you haven&amp;#039;t missed an essential step. &lt;br /&gt;
&lt;br /&gt;
For example, in Section 2.1 the reference book provides a simple example program then says &amp;quot;Now run this program and see what happens.&amp;quot; This instruction is immediately followed by an itemized list of how to do so for each platform supported by Python. Without completing a section, the eager student might be at a loss on how perform this instruction. This is a common construct used in instructional texts, e.g. &lt;br /&gt;
&lt;br /&gt;
Do X.&lt;br /&gt;
* Doing X on foo&lt;br /&gt;
* Doing X on bar&lt;br /&gt;
&lt;br /&gt;
=Class Format=&lt;br /&gt;
* Each subsection is based on a chapter or chapters from the Dive Into Python online (free) book. It is intended that these chapters be read &amp;lt;i&amp;gt;&amp;lt;b&amp;gt;before&amp;lt;/b&amp;gt;&amp;lt;/i&amp;gt; each section. &lt;br /&gt;
* Each class is based on a subsection, some subsections may span multiple classes. It is intended that the student work each subsection&amp;#039;s problems &amp;lt;i&amp;gt;&amp;lt;b&amp;gt;before&amp;lt;/b&amp;gt;&amp;lt;/i&amp;gt; each class. &lt;br /&gt;
* Each subsection is preceded by a &amp;quot;What you should know?&amp;quot; section that covers the key concepts a student should glean from the Dive Into Python content before working the problems.&lt;br /&gt;
* Each subsection is followed by set of &amp;quot;Challenge Problems&amp;quot; based on the material learned.&lt;br /&gt;
* Finally, each one hour class is dedicated to addressing any ambiguities students might have or delving deeper into any issues students may be confronted with.&lt;br /&gt;
&lt;br /&gt;
=Part I of II: The Basics=&lt;br /&gt;
==Chapters 1, 2, &amp;amp; 3==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
* How to start and exit the Python Interactive Shell&lt;br /&gt;
* Where to download the example problems&lt;br /&gt;
* How to execute a Python script on your respective platform&lt;br /&gt;
* Difference between &amp;lt;i&amp;gt;dynamic&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;static&amp;lt;/i&amp;gt; languages&lt;br /&gt;
* How to declare a function and pass arguments&lt;br /&gt;
* How to create a functions documentation&lt;br /&gt;
* How to &amp;#039;import&amp;#039; a python script&lt;br /&gt;
* About python and code indentation&lt;br /&gt;
* The if __name__ trick&lt;br /&gt;
&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
# Write a Python function that takes one variable as an argument, if it is less than 50 print the variable to screen. If it is not, print a message that says &amp;quot;Variable too large!&amp;quot;&lt;br /&gt;
# Document the function using python doc string&lt;br /&gt;
# Bonus! import your new function into another script and execute it two times, once with a variable &amp;lt; 50 and once with a variable &amp;gt; 50 &amp;lt;i&amp;gt;only if&amp;lt;/i&amp;gt; __name__ == &amp;quot;__main__&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Chapter 4: Introspection==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 5: Object-Orientation==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 6: Exceptions and File Handling==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 7: Regular Expressions==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
&lt;br /&gt;
=Part II of II: Advanced Topics or Building Robust Programs=&lt;br /&gt;
==Chapter 13: Unit Testing==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 14: Test-First Programming==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 15: Refactoring==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 16: Functional Programming==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 17: Dynamic Functions==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Chapter 18: Performance Tuning==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;br /&gt;
==Wrapping It Up: Tips and Tricks==&lt;br /&gt;
===What you should know by now===&lt;br /&gt;
===Challenge Problems===&lt;/div&gt;</summary>
		<author><name>Ccn admin</name></author>
	</entry>
</feed>