Differences

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

Link to this comparison view

ewis:laboratoare:02 [2021/03/17 17:05]
alexandru.predescu [Data Structures]
ewis:laboratoare:02 [2023/03/15 17:40] (current)
alexandru.predescu [Data Structures]
Line 79: Line 79:
         new_elem = elem / s         new_elem = elem / s
         new_list.append(new_elem)         new_list.append(new_elem)
 +        ​
 +    # TODO: same task with list comprehension ​   ​
 +    ​
     return new_list     return new_list
     ​     ​
Line 95: Line 98:
 <​note>​ <​note>​
  
-//​module1.py//​+**//​module1.py//​**
  
 <code python> <code python>
Line 102: Line 105:
 </​code>​ </​code>​
  
-//main.py//+**//main.py//**
  
 <code python> <code python>
Line 165: Line 168:
  
 <​note>​ <​note>​
-Create, access, check membership+**Create, access, check membership**
  
 <code python> <code python>
Line 180: Line 183:
 </​code>​ </​code>​
  
-Modify+**Modify**
  
 <code python> <code python>
Line 204: Line 207:
 </​code>​ </​code>​
  
-Operations (set theory)+**Operations (set theory)**
  
 <code python> <code python>
Line 240: Line 243:
 **T4 (4p)** The set is a collection of unordered (and unique) elements. Use this to your advantage to remove duplicates from a list **T4 (4p)** The set is a collection of unordered (and unique) elements. Use this to your advantage to remove duplicates from a list
  
-Tip:+Hint:
   *you can create a set from a list: ''​s = set([1,​2,​3])''​   *you can create a set from a list: ''​s = set([1,​2,​3])''​
   *you can create a list from a set: ''​v = list({1, 2, 3})''​   *you can create a list from a set: ''​v = list({1, 2, 3})''​
Line 275: Line 278:
 # looping through a dictionary: # looping through a dictionary:
 for key in d: for key in d:
- print(key) ​ # print only key +   print(key) ​ # print only key 
-    print(key, d[key]) ​ # print key and value d[key]+   ​print(key, d[key]) ​ # print key and value d[key]
  
  
Line 294: Line 297:
 else: else:
     print('​not found'​)     print('​not found'​)
 +
 +</​code>​
 +
 +<code python>
  
 # counting the number of times a letter appears in a string: # counting the number of times a letter appears in a string:
Line 318: Line 325:
 **T5 (4p - bonus)** You have a list of numbers. Write a program to show the frequency of each number as the number of times that number is found in the list. **T5 (4p - bonus)** You have a list of numbers. Write a program to show the frequency of each number as the number of times that number is found in the list.
  
-Tip: +Hint
- +  * Use dictionaries to keep track of each element
-  *Use dictionaries to keep track of each element+
 </​note>​ </​note>​
  
 **Resources**:​ **Resources**:​
  
-https://www.youtube.com/watch?​v=WGlMlS_Yydk +  * [[http://mathworld.wolfram.com/L2-Norm.html|L^2-Norm]] 
- +  * [[http://​mathworld.wolfram.com/​StandardDeviation.html|Standard Deviation]] 
-http://​mathworld.wolfram.com/​L2-Norm.html+  * [[https://​www.youtube.com/​watch?​v=WGlMlS_Yydk|Apriori Algorithm (Associated Learning) - Fun and Easy Machine Learning]]
  
-http://​mathworld.wolfram.com/​StandardDeviation.html 
  
  
  
ewis/laboratoare/02.1615993520.txt.gz · Last modified: 2021/03/17 17:05 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