This repository features a set of python lessons for use in onboarding people to the Yesselman Lab at UNL. They are to be accessible to beginners and assume zero programming experience. Part I focuses on Python
For Windows users, it is recommended to download the Cmder terminal emulator to use instead of the native Windows command prompt. Cmder runs on top of the Windows OS and helps to bridge the gap to the preferred UNIX terminals. To install, just click on the provided link and follow the instructions on the website. You will know it is working properly when you can launch the colorful terminal.
To download python, go the following link and click the button at the top of the page to download the latest version. Select the appropriate platform (Mac, Windows, Linux, etc.) and follow the directions provided. You can test that python is properly downloaded by entering python in the terminal as below:
>python
If python is installed, the terminal should enter the python command line interpreter and look something like this (though parts of the header will likely look different):
Python 3.7.7 (default, Mar 10 2020, 15:43:33)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
To exit, simply type in
>>>exit()
and hit enter. If nothing happens, this is likely because your computer does not know where python is located. This is a more common issue on Windows platforms and some common work arounds can be found here. Help for Mac users can also be found here.
The Yesselman Group's integrated development environment (IDE) of choice is PyCharm, which is developed by JetBrains. As students, you are eligible for an educational license to use the professional version, which you can apply for here. While waiting for your license, you can download the PyCharm community edition. Click on the aforementioned link, select your platform and you can download the Community version immediately!
- background information on python and programming
- generic python workflow
- Hello World program that would make K&R proud
- the use of variables to store and manipulate data
- descriptions of
int()
,float()
,str()
andbool()
types as well as operators - warnings about mixing
int
andfloat
types as well as associated narrowing - syntax and conventions for
if
statements - nesting of
if
statements and multibranching
- methods to add, remove and manipulate entries in
list()
objects - indexing and the use of the
[]
operator
- basic looping for both
for
andwhile
loops - combinding looping and conditionals
- using
break
for extra control flow
- anatomy of functions -> name, return types, parameters
- how to write user defined functions
- more detail on function calling
- intro to the
set()
object, with an emphasis on use in summarizing datasets - revisit strings and string maninpulation, covering the following methods:
.split()
.join()
.find()
.trim()
- literal declaration of
dict()
objects - manipulating key-value pairs with the
[]
operator - iterating through dict entries with
.values()
,.keys()
and.items()
- how to write a
class
- discussion of attributes, methods and magic methods
- explanation of best practices for writing effective classes
- does NOT cover polymorphism/inheritance
- how to use
import
,from [MODULE] import []
andimport [MODULE] as [ALIAS]
- best practices for using modules
- reading and writing to files
- using
open()
to create file objects and.read()
/.write()
to access text data
- tutorial on how to use the built-in
unittest
module - importance of unittestsing in projects
- best practices for writing unittests/docstrings
- how to use
plt.scatter()
,plt.hist()
andplt.plot()
- basics of making hybrid plots
- setting plot characteristics with key-word arguments (
kwargs
)
- DataFrames as a way to store and manipulate ordered data
- how to use pandas' built-in file IO system
- combining DataFrames with matplotlib
- Especially for those new to programming, Edabit is a helpful website. This is a coding website filled with tons of practice problems, starting all the way from "Hello World" programs. When just starting, spending 15-30 minutes a day on Edabit will greatly improve one's coding skills. On this site, it is important to read other solutions after finishing a problem which can be done by clicking the "view other solutions" button after completing a challenge.