Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

String Practice C

#Fill in the lines to the right with the output that will be generated by this function
def string_manipulate():
  string = "Tennessee"

  print len(string)                      #______________________________
  print min(string)                      #______________________________
  print max(string)                      #______________________________ 
  print string.count("e")                #______________________________
  print string.count('e')                #______________________________
  print string.replace("e","!")          #______________________________
  print string                           #______________________________
  print string.replace("e","!",1)        #______________________________
  print "I am in" + " " + string         #______________________________
  print string.lower()                   #______________________________
  print string.upper()                   #______________________________
  print string.isupper()                 #______________________________
  print string.islower()                 #______________________________
  print string.capitalize()              #______________________________
  print string.swapcase()                #______________________________
  print string.endswith("e")             #______________________________
  print string.endswith("o")             #______________________________
  print string.startswith("t")           #______________________________
  print string.startswith("T")           #______________________________
  print string.startswith("s")           #______________________________
  print string.find("enn")               #______________________________
  print string.find("ess")               #______________________________
  print string.find("sn")                #______________________________
  print string.rfind("s")                #______________________________
  print string[3:7]                      #______________________________
  print string[0:6]                      #______________________________
  print string[0:19]                     #______________________________
  print string[4:]                       #______________________________
  print string[:2]                       #______________________________
  print string[-1:]                      #______________________________
  print string[:-1]                      #______________________________
  print string[0::2]                     #______________________________
  print string[ len(string)-1::-1]       #______________________________
  print string[::-1]                     #______________________________
  print string.isalpha()                 #______________________________
  print string.isdigit()                 #______________________________
  printNow(string.split('s'))            #______________________________


Links to this Page