B1703 - Introduction to Programming (LM)

Academic Year 2024/2025

  • Teaching Mode: Traditional lectures
  • Campus: Bologna
  • Corso: Second cycle degree programme (LM) in Data, Methods and Theoretical Models For Linguistics (cod. 5946)

Learning outcomes

At the end of the course, the student has the necessary IT background and an appropriate knowledge of programming languages. He can use the acquired knowledge to autonomously design algorithms and data structures. He knows how to work independently, but also to be part of a work group.

Course contents

Learning outcomes

Introduction to Programming provides students with the foundations of computer programming in Python.

After completing this course, the student is able to:

  • Understand basic computer programming concepts that are general to programming languages.

  • Apply coding skills to tackle a variety of practical tasks.

  • Apply coding skills to build realistic analyses and small applications.

  • Select and reuse existing coding resources for the Python language.

  • Understand and apply foundational coding skills to tasks in linguistics.

Course contents

Coding skills are increasingly in demand: they enable us to develop the appropriate applications for processing and analyzing linguistic data, at scale. This course teaches foundational coding skills using Python, a popular programming language. The skills acquired during the course will enable students to get the most out of several more advanced courses in the program.

The practical goal is to show students 1) when and how it is possible and advisable to automate a task or analyze data programmatically; 2) how to develop custom applications, rather than only relying on ready-made ones. To this end, the course introduces foundational programming concepts (variables, data types, flow control, functions, input/output), specific techniques and resources for linguistics (strings, regular expressions, text files), and useful extensions focused on data analysis and visualization, numerical manipulation, Web crawling, and API querying.

The breakdown of the topics is as follows:

Part I (weeks 1-5): Python fundamentals
  1. Why you need to know how to code. Basic notions on how a computer works, algorithms, computability, and programming languages.

  2. Setting up your environment and first steps with notebooks.

  3. Variables, basic data types, type conversion, standard library.

  4. Basic data structures.

  5. Flow control.

  6. Functions, reading/writing files.

  7. Testing and logging your code, documentation.

Part II (weeks 6-10): Python for linguistics
  1. All about strings.

  2. Regular expressions.

  3. Text files, encodings, and useful file formats.

  4. Arrays and matrices with numpy.

  5. Getting data from the Web and using APIs.

  6. Data analysis and visualization pipeline (pandas, matplotlib, seaborn). 

Note that this list of topics is tentative and might still change slightly.


Readings/Bibliography

The following resources are recommended for further reading and doing extra exercises:

  • Peroni, Silvio, et al. 'Computational Thinking and Programming', ongoing. https://comp-think.github.io. Chapters 1-4 + exercises.

  • Walsh, Melanie. 'Introduction to Cultural Analytics & Python', 2021. https://melaniewalsh.github.io/Intro-Cultural-Analytics/welcome.html .

  • Tagliaferri, Lisa. 'How to Code in Python', 2021. https://www.digitalocean.com/community/tutorial-series/how-to-code-in-python-3 .

Teaching methods

Recommended prior knowledge

No prior knowledge is required.

Teaching method and contact hours

Lectures, with a lot of live coding, and laboratories, with a lot of exercises. To the extent possible, the provided examples and exercises will be relevant to students in linguistics. All sessions take place in person.

The students can reach out after class via email to schedule a meeting.

Teaching materials

The course materials will be made available on Virtuale and in a public Gitlab repository. Instructions will be provided, at the beginning of the course, on how to use the materials, including doing it locally on one's workstation if preferred.

Assessment methods

  • Oral exam (50%): questions on the concepts discussed during the course. Tentatively, this will happen in June, July, September. 

  • Project (50%): an individual project on a theme that will be decided with the teacher or selected by the student from a list of proposals. The students will have to submit a report on the project 20 days before the exam. There will be an oral discussion of the project in the same dates as the oral exams.

It is possible to do the oral exam and project discussion separately, or to do both during the same session.

Once submitted and positively assessed, the project grade remains valid for the academic year, until complemented by a successful exam. Similarly, the oral exam can also be conducted before the submission of the project component, and its grade remains valid for the academic year as well. 

To benefit most from the course, it is highly recommended to attend regularly, and do the exams and the project at the earliest opportunity.

Teaching tools

Slides, code with exercises, demonstrations, readings, and seminar discussions.

Classes are held in a classroom equipped with personal computers connected to the Intranet and Internet.

Office hours

See the website of Michele Corazza