GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - UWSEDS/Python-Exercises: Exercises following the Python SWC course

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
python_wtfs
python_wtfs
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
exercises.py
exercises.py
 
 
optional.py
optional.py
 
 
pyproject.toml
pyproject.toml
 
 
refactoring.py
refactoring.py
 
 

Repository files navigation

Python-Exercises

Exercises following the Python SWC course

Layout

A quick introduction to the files in this repository:

  • exercises.py: contains exercises you should be able to solve after the SWC. There are non-exhaustive tests in the second half of the file that you can test your implementation against

  • optional.py: contains optional exercises for those who are already more familiar with Python and want a challenge.

  • refactoring.py: code from alan-turing-institute/bad-boids/ that we've annotated with things to think about as you improve the code. The authors have a GitHub branch with their recommended refactoring, but some of those concepts are well beyond the scope of what we want to cover now. That said, feel free to take a look through!

  • python_wtfs: a folder of wacky exercises that show unexpected ways Python can misbehave.

exercises.py

To run the code you have a few options:

  • run python from the terminal, import one of the test functions, and run it.
from exercises import test_every_other_element
test_every_other_element()
  • run the entire file like python exercises.py, but this runs all the tests that are uncommented at the very bottom of the file, even the ones you haven't completed yet.

If your implementation is correct, you won't see anything on your screen, but if your code was incorrect you might see something like:

Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
test_every_other_element()
~~~~~~~~~~~~~~~~~~~~~~~~^^

File "/home/iq/personal/Python-Exercises/exercises.py", line 124, in test_every_other_element
assert every_other_element([1, 2, 3]) == [2]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Learning And productivity

Some of these exercises are hard and you shouldn't feel bad about taking a lot of time working on them. Struggling (productively) is a part of the learning process. If you find yourself spinning your wheels you should take a quick walk and return to the problem(s) later. The goal isn't to be done with the exercises. It's to understand why your solution works and how the core ideas can be transferred to other problems.

About

Exercises following the Python SWC course

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.