Skip to content
Constantin Orasan's page
  • Blog
  • Publications
  • Research
    • Events organised
  • Twitter
  • GitHub
October 25, 2021 by c.orasan

PyP4L: Week 2: Getting started with Python

PyP4L: Week 2: Getting started with Python
October 25, 2021 by c.orasan

The plan for the second week is to start learning some basic Python notions. Before that, I usually introduce the notion of pseudocode as an easy way of describe how to solve problems. This allows me to discuss problems for which we do not have all the necessary programming background to implement them. I tend to keep a fairly informal definition of pseudocode. After that, I introduce the notions of data types and variables. We learn about integers, floats and strings. I also discuss branching (if-then-else) as a first way of controlling the flow of the program.

Pseudocode

Without being too formal, the notion of pseudocode is introduced and used to design the solution how to generate the ing form of an English verb. The solution is not complete. It is just a proof of concept. If you send me a more complete solution, I will be more than happy to include it in the slides (making sure the author is acknowledged).

If you want you can download the slides or the notebook used to generate these slides.

Variable and data types in Python

This video introduces the notion of data type and gives examples of data types in Python. After that it defines the notion of variable and shows how variables are used in Python.

If you want you can download the slides or the notebook used to generate these slides.

Strings

The first data type discussed in more detail is strings. I introduce strings and discuss the operations that can be applied to them.

If you want you can download the slides or the notebook used to generate these slides.

Controlling the flow of the program (part 1): branching

The if-then-else statement is introduced as the first way to control the flow of execution. In addition, the lecture introduces the Boolean data type and operations that can be applied to this data type.

If you want you can download the slides or the notebook used to generate these slides.

If you have difficulties navigating these slides have a look at this post.

Exercises for this week

  • This week I normally give students some simple exercises with strings. At some point in the future I will probably make the available.
  • Read chapters 2 and 3 from Michael Dawson (2010) Python Programming for the absolute beginner. Course Technology PTR
  • Watch What exactly is an algorithm? Algorithms explained from BBC Ideas

Related

Previous articlePyP4L: Week 1

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Python Programming for Linguists (PyP4L)

  • Week 1: Getting started
  • Week 2: Getting started with Python

  • How to create word frequency lists in Python

  • How to see the slides
Posterity WordPress Theme