Page 133 - CatalogNEP-PS
P. 133

Identifiersandkeywords;Literals,numbers,andstrings;Operators;Expressions;Input/output
               statements; Defining functions; Control structures (conditional statements, loopcontrolstatements,
               break, continueand pass, exitfunction), default arguments.
               UNIT III:                                                                          (10 Hours)

               Built-inDataStructures
               Mutable  and  immutable  objects;  Strings,  built-in  functions  for  string,  string  traversal,
               stringoperators and operations; Lists creation, traversal, slicing and splitting operations, passing
               listtoafunction; Tuples, sets, dictionaries, andtheiroperations.
               UNIT IV:                                                                            (6 Hours)

               ObjectOrientedProgramming
               Introductiontoclasses,objects,andmethods;Standardlibraries.
               FileandExceptionHandling
               Filehandlingthroughlibraries;Errorsand exceptionhandling.

               PRACTICAL (15 Hours)


                  ListofPRACTICALS:
                  1.  WAPtofindtherootsofaquadratic equation
                  2.  WAPtoacceptanumber‗n‘and
                          a.  Check if ‘n‘ is prime
                          b.  Generate all prime numbers till ‗n‘
                          c.  Generate first ‗n‘ prime numbers This program may be done using functions
                  3.  WAPtocreateapyramidofthecharacter‗*‘andareversepyramid
                                                               *
                                                              ***
                                                            *****
                                                           *******
                                                          *********
                                                          *********
                                                           *******
                                                            ******
                                                              ***
                                                               *
                   9.  WAPthatacceptsacharacterandperformsthefollowing:
                          a.  print whether the character is a letter or numeric digit or a special character
                          b.  if the character is a letter, print whether the letter is uppercase or lowercase
                          c.  if the character is a numeric digit, prints its name in text (e.g., if input is 9, output is
                             NINE)
                          d.  WAP to perform the following operations on a string
                          e.  Find the frequency of a character in a string.
                          f.  Replace a character by another character in a string.
                          g.  Remove the first occurrence of a character from a string.
                          h.  Remove all occurrences of a character from a string.
                   10. WAPtoswapthefirstncharactersoftwostrings.
                   11. Write a function thataccepts two strings and returnsthe indicesof all the occurrencesof the
                      second  string  in  the  first  string  as  a  list.  If  the  second  string  is  not  present  in
                      thefirststringthenitshouldreturn-1.
                   12. WAP  to  create  a  list  of  the  cubes  of  only  the  even  integers  appearing  in  the  input
                      list(mayhaveelementsofothertypesalso)usingthefollowing:
                          a.  'for' loop
                          b.  list comprehension


                                                                                                           118
   128   129   130   131   132   133   134   135   136   137   138