Python Revision tour - 2  || Type C || Sumita Arora || Class 12 || Computer science || Information practices || Solution ||

 

Q1 = Write a program that prompts for a phone number of 10 digit and two dashes , with dashes after the area code and the next three number . Display if the phone number enter is valid format or not and display if the phone number is valid or not .



Q 2 = Write a program that should prompts the user to type some sentence (s) followed by “enter ”. it should then print the original sentence (s) and the following statistics relating to sentence (s) : I = number of words II = numbers of character (including white-space and punctuation )III = percentage of character that are  alphanumeric


Q 3 = write a program that takes any two list l and m of the same size and adds their elements together to form a new list n whose element are sum of the corresponding elements in l and m .




Q 4 = write a program rotates the elements of a list show that the element at the first index moves to the second index ,the element i n second index moves to the third index , etc , and the element in the last index moves to the first index .



Q 5 = write a short python code segment that print the longest word in the list of the word .




Q 6 = write a program that creates a list of all integers less then 100 that are multiples of 3  or 5 .




Q 7 = Define two variables first and second show that first = “jimmy ” and second  = “johny” . write a short python code segment that swaps the values assigned to these two variable and print the results .




Q 8 = write python that create a tuple storing first 9 term of Fibonacci series .




Q 9 = Create a dictionary whose keys are month name and whose values are  number of days  in the corresponding month :(a) ask the user to enter the month name and use the dictionary to tell how many days are in month .(b) print out all of the keys in alphabetical order  .(c) print out all of the month with 31 days (d) print out the (key - value) pair sorted  by the number of the days in each month .





Q 10 = Write a function called addDict(dict 1,dict 2 ) which computes the union of to dictionaries . it should return a new dictionary , with all the items in both its argument . if the same key appear in both arguments , feel free to pick a value from either .




Q 11 = Write a program to sort a dictionary’s keys using bubble sort and produce the sorted keys as a list .




Q 12 = Write a program to sort a dictionary’s value using bubble sort   and produce the sorted values as a list .

 

 

 

Python Revision tour - 2 class 12 solution

Python Revision tour - 2  || Sumita Arora || Class 12 || Computer science || Information practices || Solution ||

6 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post