A practical review of python in one day

I was asked to teach people programming on python from scratch in one day. Initially, the task was not to understand it deeply but to see the possibilities. To touch rest-api, and to hook machine learning.

I broke the day into 4 parts:

  1. Actually python. Common phrases about programming languages, what it is and why; why is python, its differences from other languages, why it is cool. Further about the console, work with it. From practice, install the python, write a string to the console, then work with indents, a conditional statement, function syntax, write a function to convert the ruble into dollars, then back, input from the console, passing a result from call a function as parameter to another function.
    Main problems: did not put a tick to add a python to the path; mixing spaces and tabs in indents (they wrote in a notepad); number of indents; attempts to run python files already from the interpreter.
  2. google calendar API . A few words about api and why companies in general make them. Further by the tutorial we turn on the api, download credentials.json; install libraries; and copy and run the example. Understand what’s going on in it, what are the parameters and methods exist, minimally correct – make a function from it that returns a string glued from events, we will use it in the next section.
    Main problems: credentials.json does not donwloaded in IE; libraries install under the administrator (yes, it is Windows); credentials.json is not needed to run, but it is necessary to put next to the Python file
  3. Telegram bot . Create a bot on your phone in FatherBot, install the library, copy first example and run. After the failure – tell about the insertion of your token. After the launch and silence – tell that the telegram is blocked. But! Add the proxy_url parameter (see result) and everything is ok. Next, add the calendar – copy the handler, add the import and call the function from the previous step. And we have a telegram bot, which returns the 10 nearest events from the calendar.
    Main problems: The ‘Unauthorized’ error is an invalid token; ‘Telegtam not found’ – did not install the library; and some syntax errors.
  4. Machine learning in 5 min . Revealed the article, told. Discussed.

The result: https://github.com/l1va/teledarbot

About the participants. Quite an interesting experience, as most diligently struggled with emerging issues. I had 4 groups, after the first one I made a list of errors, and already the second and subsequent groups went faster. I did not force the last part (machine learning) to program, I just showed it, that’s too much for the first time. Some got a little faster than the rest of the group – i gave additional tasks.

Add comment

avatar