Through thick and thin... well, a driving through a big dense cloud of fog that is, we made it to Maynooth (slightly bit late). Although it wasn't as bad earlier in the day when I was packing the notebooks:
With sandwiches and hot tea/coffee to welcome us, we are pretty spoilt. So we began the workshop after finding out that nearly everyone has Python on their machine and the workshop content. That made it easier for us, plus we had three mentors to help us out. Thanks, Maria, for bringing more help.
For those curious, here's how to setup Python on Windows.
You can find out more information on setting the environment variables (Windows only) so you can run Python easily via command line here via another blog post.
We have more Mac users than Windows users, which really makes Mick and I very happy indeed.
Everyone was quite attentive with a few questions here and there, and I think overall, most people got something out of the beginners Python workshop.
I also showed how to comment out code so Python will ignore it if you run the Python script, just add a "#" in front, e.g.:
Lists - removing items from a list
You create a list of items (all text):
>>> treasure=["diamonds", "gold", "silver", "sword"]
You can remove the last item by "popping":
>>> treasure.pop() 'sword'
You can assign something you pop to a variable, e.g. a_treasure = treasure.pop()
You can check what's left in your treasure list:
>>> treasure ['diamonds', 'gold', 'silver']
You can delete the second item from the list altogether:
>>> del(treasure) >>> treasure ['diamonds', 'silver']
Let's re-create the list again:
>>> treasure=["diamonds", "gold", "silver", "sword"] >>> treasure ['diamonds', 'gold', 'silver', 'sword']
Let's user slicing, and get the first two items and assign it to a variable "treasure2":
>>> treasure2 = treasure[0:2] >>> treasure2 ['diamonds', 'gold']
For those who came along to the workshop, don't be afraid to play around with the code.
Why command line?
Running it via command line gives you an advantage of seeing where the errors occurred in the Python script you just ran
$ python game_10.py File "game_10.py", line 183 print("Making an error on purpose) ^ SyntaxError: EOL while scanning string literal
To fix this, you close the double-quotes:
print("Making an error on purpose")
$ python game_10.py What's your name? >
If you try to "double-click" a .py file on Windows, it will execute and exit straight away if there's an error without you knowing what's wrong, or where it's going wrong.
With command line, you can run the Python interpretor, and test Python code snippets to your hearts content. It's what developers use a lot to be certain that code does what it's expected. Plus you can use it as an overkill calculator.
Here are a couple of kind tweets
@CodingGrace Awesome Python Workshop tonight! Can't wait to introduce my young cousins to programming now!— MyNameIsMizu (@MizuAteMyNoodle) November 25, 2014
I really enjoyed my evening in NUIM and I hope everyone enjoyed the workshop. Do share if you added more to the game in the comments below.
Thanks to everyone who came along, Maria for setting this up, NUIM for looking after us, mentors who helped Mick and myself out. You are all awesome, and I would be delighted to come back again.
Here's what I was doing after I got home and had dinner. :-)
A December newsletter will be coming out early next week giving you heads up on upcoming workshops, what's in the works and all the events I can find that are interesting that are happening around Ireland (but mostly in Dublin). You can sign up to our monthly newsletter by going to CodingGrace.com.
If you have any questions, you can email firstname.lastname@example.org.