Differences

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

Link to this comparison view

ewis:laboratoare:03 [2022/03/23 18:06]
alexandru.predescu [Task]
ewis:laboratoare:03 [2023/03/22 17:51] (current)
alexandru.predescu [Task]
Line 135: Line 135:
 </​code>​ </​code>​
  
-<​note>​**T1 ​(4p)** Having a list, filter the even numbers and get the sum of the squared elements.+<​note>​**T1** Having a list, filter the even numbers and get the sum of the squared elements.
   *Example list (random generator)   *Example list (random generator)
 <code python> <code python>
Line 267: Line 267:
  
 ==== Task ==== ==== Task ====
 +**T1 (2p)** Lab task presented above
  
-1. Use the functions presented in this lab to read text from a data file and count the number of occurrences for each word. Print the words sorted by the number of occurrences ​**(3p)**+**T2 (3p)** ​Use the functions presented in this lab to read text from a data file and count the number of occurrences for each word. Print the words sorted by the number of occurrences. ​
  
   *Text file: {{:​ewis:​laboratoare:​random_text.txt|download}}   *Text file: {{:​ewis:​laboratoare:​random_text.txt|download}}
   *Hint: You may use a dictionary   *Hint: You may use a dictionary
   *Check [[ewis:​laboratoare:​02|Lab 2]] for working with dictionaries   *Check [[ewis:​laboratoare:​02|Lab 2]] for working with dictionaries
-  *Sorting ​dictionary by values as described [[https://​www.programiz.com/​python-programming/​methods/​built-in/​sorted|here]]:​ <code python>​sorted_dict = sorted(dict.items(),​ key=lambda e: e[1], reverse=True)</​code>​+  *Sorting dictionary ​items by values as described [[https://​www.programiz.com/​python-programming/​methods/​built-in/​sorted|here]]:​ <code python>​sorted_dict = sorted(dict.items(),​ key=lambda e: e[1], reverse=True)</​code>​
  
  
-2. Print the Netflix titles into a text file **(3p)**+**T3 (2p)** ​Print the Netflix titles into a text file. 
  
-3. Print the Netflix titles and release years into a text file, using the CSV format, sorted by release year **(4p)**+**T4 (3p)** ​Print the Netflix titles and release years into a text file, using the CSV format, sorted by release year. 
  
 ==== Resources ==== ==== Resources ====
ewis/laboratoare/03.1648051590.txt.gz ยท Last modified: 2022/03/23 18:06 by alexandru.predescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0