85 of 100 menu

Python Taskbook Level 9.5

Given an arbitrary two-dimensional list:

[ [11, 12, 13, 14, 15], [21, 22, 23, 24, 25], [31, 32, 33, 34, 35], [41, 42, 43, 44, 45], [51, 52, 53, 54, 55], ]

Zero out the elements of its main diagonal:

[ [ 0, 12, 13, 14, 15], [21, 0, 23, 24, 25], [31, 32, 0, 34, 35], [41, 42, 43, 0, 45], [51, 52, 53, 54, 0], ]

Make a function that will set the correct form of a noun after a number. Here's how the function should work:

func(1, 'apple', 'apples', 'apples'); // will bring out '1 apple' func(2, 'apple', 'apples', 'apples'); // will bring out '2 apples' func(3, 'apple', 'apples', 'apples'); // will bring out '3 apples' func(4, 'apple', 'apples', 'apples'); // will bring out '4 apples' func(5, 'apple', 'apples', 'apples'); // will bring out '5 apples'

Here is an example for two-digit numbers:

func(11, 'apple', 'apples', 'apples'); // will bring out '11 apples' func(12, 'apple', 'apples', 'apples'); // will bring out '12 apples' func(21, 'apple', 'apples', 'apples'); // will bring out '21 apple' func(23, 'apple', 'apples', 'apples'); // will bring out '23 apples'

Our function should work for numbers of any length:

func(1223421, 'apple', 'apples', 'apples'); // will bring out '1223421 apple'
enru