Page 386 - Computer Science Class 11 Without Functions
P. 386

16.   Write a program that accepts a list of n numbers and prints the largest number. Do not use the built in methods,
             instead develop a function of your own to find the largest number in the list.
         17.   Write a program that accepts n strings and appends them to an empty list one by one to form a list of strings.
             Finally, traverse the list to display all strings that begin with a vowel.
         18.  Write a program that displays alternate elements of a list.

         19.   Write a program that accepts a list of n numbers and displays the number that appears  the maximum number of
             times.

         20.   Write a program that accepts n numbers and stores them in a tuple. Thereafter, the program prints square of odd
             numbers and square root of even numbers.

         21.   Write a program that defines a tuple of n strings. Thereafter, a new tuple is created that has each element as
             (string, length of string). For example, given that

             tple =  ('Rise', 'and', 'Shine', 'Always')
              the new tuple should be

             (('Rise',4),('and',3),('Shine',5),('Always',6))
         22.   Write a program that accepts the names and hobbies of 10 persons and stores this information in the form of a
             dictionary. The program should enumerate distinct hobbies.
         23.   Write a program in Python that accepts the  names of the states and the  number of districts in the states.  The
             data is stored in a dictionary.  Thereafter, the user is asked to enter a state and the number of districts in that state
             are displayed. Appropriate message is displayed if the name of the state does not exist in the dictionary.



















































         384   Touchpad Computer Science-XI
   381   382   383   384   385   386   387   388   389   390   391