Warning
This page is located in archive. Go to the latest version of this course pages.

Self check in four steps

The folowing self check is not graded. Your feedback from the self check helps to develop further the contents and the organization of PGE.

Self check is a compulsory part of the PGE course.
Work out the self-check individually, without asistance of other persons.

Step 1. Open your Python IDE or programming editor on your computer or on the web.

Step 2. Write function ff with two parametrs. The first parameter is a list of integers L, the second parameter is a single integer x. The function returns the number of such elements in L which value differs from x by less than 10.
For example, ff returns 2, when list L is [22, 70 31, 49, 60] and x is 25.

Step 3. Copy into your code the list longList given below in the Data section. Pass longList as the first parameter to ff and pass value 50 as a second parameter to ff. Call ff with the given parameters and verify that this call returns value 39 when you run the program.

Step 4. Report Write an e-mail to PGE teacher Marko Berezovsky (berezovs@fel.cvut.cz) .
In the e-mail, specify the approximate time you spent on the self check.
If you have encountered any difficulties while preforming the self check, describe them in the e-mail.
If you experienced no difficulties, mention it in the email.
Do NOT send the code of your solution!

Thank you for your cooperation!

Data

longList = [
    81, 40, 59, 40, 45, 39, 60, 90, 60, 31, 86, 21, 11, 67, 19, 10, 71, 45, 74, 10,
    71, 80, 74, 92, 32, 22, 98, 49, 31, 37, 41, 34, 18, 85, 47, 34, 35, 48, 49, 12,
    70, 99, 96, 15, 24, 66, 34, 51, 68, 79, 98, 94, 34, 48, 26, 47, 11, 41, 56, 72,
    96, 35, 41, 50, 15, 92, 59, 72, 69, 20, 11, 68, 19, 19, 87, 52, 60, 56, 66, 33,
    44, 46, 12, 18, 58, 23, 48, 62, 79, 80, 33, 10, 34, 66, 19, 66, 70, 12, 84, 46,
    68, 74, 45, 23, 94, 70, 36, 59, 86, 15, 23, 66, 96, 50, 10, 42, 35, 30, 68, 91,
    60, 49, 96, 75, 66, 98, 21, 10, 77, 44, 62, 67, 84, 40, 77, 84, 45, 82, 14, 36,
    42, 70, 54, 48, 13, 12, 89, 31, 91, 28, 25, 15, 16, 12, 67, 81, 97, 18, 89, 51,
    10, 97, 76, 99, 60, 80, 27, 31, 80, 49, 42, 85, 62, 35, 96, 90, 89, 79, 39, 30,
    84, 15, 84, 25, 50, 51, 14, 99, 78, 12, 80, 97, 76, 89, 47, 64, 62, 14, 14, 85
]

courses/be5b33pge/practices/self_check.txt · Last modified: 2022/02/14 13:28 by berezovs