Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lfa:2022:lab01-programming-intro [2022/10/07 16:13]
pdmatei
lfa:2022:lab01-programming-intro [2022/10/14 13:13] (current)
mihai.udubasa add solutions
Line 23: Line 23:
 </​code>​ </​code>​
  
-**Exercise 1.3** Write a function which takes a list of records first name, last name, CNP (encoded as tuples), and returns a list of the last names and ages of all females which are younger than the average of the entire list. E.g. ''​List( (“Mary”,​ “2030694123456”),​ (“Anne”,​“2121092123456”),​ (“Matei”,​ “5121202123456”),​ (“Maggie”,​ “2121078123456”))''​ yields ''​List( (“Mary”,​28),​ (“Anne”,​30))''​. Maggie was born in '78, whereas Mary, Anne and Matei were born in '94, '92 and 2002, respectively. (Hint: use combinations of **map** with **filter**)+**Exercise 1.3** Write a function which takes a list of records first name, last name, CNP (encoded as tuples), and returns a list of the last names and ages of all females which are younger than the average of the entire list. E.g. ''​List( (“Mary”,​ “2030694123456”),​ (“Anne”,​“2121092123456”),​ (“Matei”,​ “5121202123456”),​ (“Maggie”,​ “2121078123456”) )''​ yields ''​List( (“Mary”,​28),​ (“Anne”,​30) )''​. Maggie was born in '78, whereas Mary, Anne and Matei were born in '94, '92 and 2002, respectively. (Hint: use combinations of **map** with **filter**)
  
 <code scala> <code scala>
Line 447: Line 447:
   * ''​None'':​ represents the lack of a value (or an explicit None value); useful to mark functions which have no return value, or that a value may be purposefully missing (in combination with the ''​|''​ operator), and a None check may be necessary   * ''​None'':​ represents the lack of a value (or an explicit None value); useful to mark functions which have no return value, or that a value may be purposefully missing (in combination with the ''​|''​ operator), and a None check may be necessary
 full documentation of the python typing module: [[https://​docs.python.org/​3/​library/​typing.html]] full documentation of the python typing module: [[https://​docs.python.org/​3/​library/​typing.html]]
 +
 +
 +
 +===== Solutions =====
 +<note important>​
 +[[https://​github.com/​NethDR/​LFA-LAB1-solutions|click here for spoilers/​solutions]]
 +</​note>​