Assignment 1 - Basics of Python
Assignment 1 - Basics of Python
Q3. S1 is a set defined as S1= [10, 20, 30, 40, 50, 60].
S2 is a set defined as S2= [40, 50, 60, 70, 80, 90].
(i) WAP to add 55 and 66 in Set S1.
(ii) WAP to remove 10 and 30 from Set S1.
(iii) WAP to check whether 40 is present in S1.
(iv) WAP to find the union between S1 and S2.
(v) WAP to find the intersection between S1 and S2.
(vi) WAP to find the S1 - S2.
Q5. WAP to create two lists of 10 random numbers between 10 and 30; Find
(i) Common numbers in the two lists
(ii) Unique numbers in both the list
(iii) Minimum in both the list
(iv) Maximum in both the list
(v) Sum of both the lists
Q6. WAP to create a list of 100 random numbers between 100 and 900. Count and print the:
(i) All odd numbers
(ii) All even numbers
(iii) All prime numbers
Q9. Write to the file 100 random strings whose length between 10 and 15.
Q10. Write to the file all prime numbers between 600 and 800.
Q12. WAP to sort following number of elements in a list, calculate time taken and plot the graph.
Number of elements in list Time Taken
50k T1
100k T2
150k T3
200k T4
250k T5
Q13. WAP to create a dictionary of student marks in five subjects and you have to find the student
having maximum and minimum average marks.