Skip to content
Sumita Arora Solutions
Join Our Community
Class 12 Projects
Solutions to Sumita Arora Assignment in Chapter 2.
[Type A] Chapter – 2 Class 12 CS – Sumita Arora Assignment | Q/A
[Type B] Chapter – 2 Class 12 CS – Sumita Arora Assignment | Q/A
[Type C]Q1. Write a program that prompts for a phone number of 10 digits and two dashes, with dashes after the area code and the next three numbers. For e.g] 017-555-1212 is a legal input. Display if the phone number entered is a valid format or not and display if the phone number is valid or not. (i.e contains just the digits and dash at specific places)
[Type C]Q2. Write a program that takes any two lists L and M of the same size and adds their elements together to form a new list N whose elements are sums of the corresponding elements in L and M. For instance, if L =[3,1,4] and M=[1,5,9] then N should equal[4,6,13].
[Type C]Q3. Write a program that should prompt the user to type some sentence(s) followed by “enter”. It should then print the original sentences and the following statistics relating to the sentences.
[Type C]Q4. Write a program that rotates the elements of a list so that the element at the first index moves to the second index, the element in the second index moves to the third index, etc, and the element in the last index moves to the first index.
[Type C]Q5. Write a short python code segment that prints the longest word in the list of words.
[Type C]Q6. Write a program that creates a list of all integers less than 100 that are multiple of 3 or 5.
[Type C]Q7. Define two variables first and second such that first=’Jimmy’ and second =’Johnny’. Write a short Python code segment that swaps the values assigned to these two variables and prints the results.
[Type C]Q8. Write a python program that creates a tuple storing first 9 terms of the Fibonacci series.
[Type C]Q9. Create a dictionary whose keys are month names and whose values are the number of days in the corresponding months.
[Type C]Q10. Write a function called addDict(dict1, dict2) which computes the union of two dictionaries. It should return a new dictionary, with all the items in both its arguments. If the same key appears in both arguments, feel free to pick a value from another.
[Type C]Q11. Write a program to sort a dictionary’s keys using bubble sort and produce the sorted keys as a list.
[Type C]Q12. Write a program to sort a dictionary’s values using Bubble sort and produce the sorted values as a list.
You cannot copy content of this page