Week-5 Lab
Week-5 Lab
2. Write a Python function to return the Max, Min of a given list of items
4. Write a Python function that accepts a string and calculate the number of upper
case letters and lower case letters
5. Write a function that returns N random numbers in the range [P,Q], with the
following constraints:
i) N <= Q-P+1
ii) No duplicates in the result
Part B:
write a function to rearrange the elements in a list (Use the above function)
6. Write a Python function that takes a list and returns a new list with unique
elements of the first list.
7. Generate 100 random integers in the range [1,6]. Count how many '1's, '2's, ...,
'6's. Can it be used as a fair die.
9. Write a Python function to check whether a string contains every letter of the
alphabet at least once.
12. Write a Python program that prints 1 .. 10, After printing a number, it wait
for 1 sec.
14. Copy elements from one list to the other list. Using list comprehension and
without list comprehension
15. Implement K-Means algorithm (Explain the logic, with example by instructor.
Implementation by students)
16. Curse of dimentionality:
a) Genate 10 points randomly in the range [0,1]. Find the average distance
between any two points.
b) repeat the same problem for dimensions 1, 3, 10, 100
c) plot a graph between dimensions and the avergage distance.
17. Implement K-NN algorithm