Home

Awesome

pybasictraining

This is a repository that we'll use as a tool to teach you python. This is an interactive learning experiment that gives you a number of challenges to beat. To pass the challenges you will need to write python code.

Once you have passed these challenges, and understand the concepts required for passing the challenges, you should have a reasonable grasp of how to do a lot of basic things in python.

Preparation

Install the requirements

One of the really useful things about python is that you can write code that behaves the same regardless of which platform you're running it on. As such, the challenges should function the same regardless of whether you're using Windows or OSX or Linux. However, each platform will require slightly different steps to install the necessary requirements.

OSX/Linux

You need to have the following things installed:

Windows

You need to have the following things installed:

Get the code

You need to clone this git repository somewhere on your computer. You can use eclipse to do this, or open up a terminal and run the following:

git clone https://github.com/frc1418/pybasictraining.git

About the challenges

In the challenges section, each bullet point is a challenge you must complete. The name of the challenge is listed first, followed by the description of the challenge.

Please keep in mind that there are generally many different ways you can get the challenge tests to pass, but typically each test is a simple step that builds upon the knowledge/things done in previous tests. You are encouraged to complete the tests in order.

Testing to see if you beat the challenges

The challenges currently need to be run in the terminal/command line. This means you need to open up a terminal or cmd and change directories to wherever you checked out the code.

For help using the terminal, see this resource.

There are two ways to run the challenges. If you think your code can beat ALL of the challenges, then you can do the following:

OSX/Linux: ./run_all.sh
Windows:   run_all.bat

However, running all the challenges can be a bit confusing and give you a lot of errors that you don't care about when concentrating on beating the current challenge. To run a single challenge, do this instead:

OSX/Linux: ./run_single.sh CHALLENGE
Windows    run_single.bat CHALLENGE

So for example, to run challenge v1 on OSX or Linux, you would do this:

./run_single.sh v1

Whereas on Windows you would do this:

run_single.bat v1

Should be simple enough!

The Challenges

Creating files

Variables

The code for these challenges should be added to mycode.py

Functions & logic

The code for these challenges should be added to mycode.py

Modules

The code for these challenges should be added to mycode.py

Tuples

The code for these challenges should be added to mycode.py

Lists

The code for these challenges should be added to mycode.py

Dictionaries

The code for these challenges should be added to mycode.py

Classes & objects

The code for these challenges should be added to mycode.py. When mentioning the number of parameters for class methods, the self parameter is not included in the count.

State Machine

The code for these challenges should be added to mycode.py. When mentioning the number of parameters for class methods, the self parameter is not included in the count.

Exceptions

TODO

If you're having problems

  1. Google for the solution (or bing, whatever)
  2. Send an email to your peers, and see if they can help
  3. Send an email to your team's mentor(s)

Most of the things that we're doing here is pretty simple, and google should be able to point you to answers. Often, it will point you at Stack Overflow, which is a really excellent resource for lots of programming questions.