Institute of Computer Science
  1. Courses
  2. 2022/23 fall
  3. Concurrent Programming Languages (LTAT.06.022)
ET
Log in

Concurrent Programming Languages 2022/23 fall

  • Pealeht
  • Loengud
  • Labs
  • Viited
  • Homework

This exercise presents implementations for the main issues we studied in Python Asyncio.

1) Compute the factorial number for a group of numbers, each number in a specific task. Each task (factorial number) has it is own call. You have to schedule the calls concurrently. Print out the declaration of the factorial number and the calculation result. Between the two printouts, there is a wait.

Note: The factorial of a positive integer (number) is the sum of the multiplication of all the integers smaller than that positive integer. For example, the factorial of 4 is 4 * 3 * 2 * 1, which equals 24.

2) Create a program to print out random numbers in many tasks; each task performs a single number. The program must wait for all tasks to be completed.

3) Create a program to print out a random number in a coroutine with a timeout; execute and wait for the task without a timeout. Apply the exception using asyncio.TimeoutError

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment