Recently, I had the opportunity to teach Python to new employees in the workplace for a short period of time, so I would like to summarize what I did at that time. The motivation for choosing Python for newcomer education is as follows.
By the way, the newcomer has mastered C ++ to some extent before that, and has no programming experience before that.
The first is the preparation of the environment.
pyenv Since the OS used Ubuntu, Python was included from the beginning, but I wanted to have experience of installing it, so I created an environment with pyenv. At the same time, I have told you that Python has 2 and 3 systems. This time I'm using Python 3.6.2.
Hello world!
Once Python is in, create hello.py and it's Hello world!
. Since the editor used Visual Studio Code, it was ready just by inserting the extension for Python. Here you can learn how to run python.
$ python hello.py
Jupyter Notebook
Install Jupyter because it is convenient to have an interactive execution environment to write learning code in the introduction. At this time, pip
is explained. At first, I looked at the introductory site and asked Jupyter to write the code while summarizing it to some extent.
It also introduces an online execution environment such as paiza.io.
Dive Into Python 3 http://diveintopython3-ja.rdy.jp/index.html
For the time being, I asked him to write the code in Jupyter while looking here. However, I didn't have much time, so it seems like the first half is rough. Such a page is helpful. Personally, I think Python will be fun if you can make good use of list comprehensions.
Google Code Jam https://code.google.com/codejam/past-contests
I asked them to solve a simple past question of Google Code Jam by selecting it from the Qualification Round. The aim is to teach basic file input / output, character string operations, and simple algorithms. For example, I think that the knowledge here will be useful when writing a script that analyzes some kind of log file. Also, here are some techniques (?) That are useful to know when you have Google Code Jam solved.
with open('./sample.in') as f:
#Remove annoying newline characters at the end with slices
line = f.readline()[:-1]
#Unpack assignment of space-separated data to individual variables
a, b, c = f.readline()[:-1].split()
#If you want to make it int, convert it with list comprehension notation
a, b, c = [int(x) for x in f.readline()[:-1].split()]
Slackbot I thought that I would get bored even if I wrote only the code I was studying, so I asked him to make a program that was easy to make but had a slightly amazing feeling. This time, as a theme, I have Slackbot made because I use Slack at work. It was easy to implement by referring to here. As a device, I made it to return the weather forecast. Obtaining the weather forecast with Python was also easily realized by referring to here.
It seems that it was fun for newcomers to make this. Good: smile:
Django Girls Tutorial https://djangogirlsjapan.gitbooks.io/workshop_tutorialjp/content/
This is just an introduction because the period is not enough, but it will be a tutorial for creating a web application using Django. It is wonderful that it is explained carefully enough to proceed without knowledge of Web development. In the tutorial, CSS is also prepared and it looks good, and since it is also deployed using Heroku, it is completed, and I thought that it would be fun to make it like the above Slackbot. I introduced it. I would like you to take on the challenge.
Although it was a short period of time, I was able to create a working program and it was fun for the teaching side. I hope you like Python.
Recommended Posts