ࡱ>   !"#$%&'()*+,-Root Entry Fc&,WordDocument-&1Table&SummaryInformation(_ bjbj -&>\>\ xxxxx 4 @       $"z%) x) xx> cccfxx c ccc,"cT 0 c&#@&c&xcc) ) c & > >: Programming String-1 def main(): # Receive user input full_name = input ('Enter your full name: ') # Split according to spaces name = full_name.split() # The first character of each name is an initial for string in name: print(string[0].upper(), sep='', end='') print('.', sep=' ', end='') # Call the main function. main() Programming String-2 def main(): # Get a string of numbers as input from the user. number_string = input('Enter a sequence of digits ' \ 'with nothing separating them: ') # Call string_total method, and store the total. total = string_total(number_string) # Display the total. print('The total of the digits in the ' \ 'string you entered is', total) # The string_total method receives a string and returns # the total of all the digits contained in the string. # The method assumes that the string does not contain # non-digit characters def string_total(string): # Local variables total = 0 number = 0 # Step through each character in the string. for i in range(len(string)): # Convert the character to an integer. number = int(string[i]) # Add the value to the running total. total += number # Return the total. return total # Call the main function. main() Programming String-3 def main(): # Local variables day = 0 month_num = 0 month_name = '' date_string = '' month_list = ['January', 'February','March', 'April', 'May','June', 'July', 'August', 'September', 'October', 'November', 'December'] # Get the date in mm/dd/yyyy format as input from the user. date_string = input('Enter a date in the format mm/dd/yyyy: ') # Split date_string. date_list = date_string.split('/') # Obtain month and day numbers. month_num = int(date_list[0]) day = date_list[1] year = date_list[2] # Get month_name. month_name = month_list[month_num - 1] # Create string for long date format. long_date = month_name + ' ' + day + ', ' + year # Display long date format. print(long_date) # Call the main function. main() Programming String-5 def main(): # Local variables digit_list = ['2','3','4','5','6','7','8','9'] alpha_phone_number = '' num_phone_number = '' # Get the string as input from the user. alpha_phone_number = input('Enter the telephone ' \ 'number in the format' \ ' XXX-XXX-XXXX: ') # Step through the string finding the index number # from the digit list for each character. Build the # string, and display the digits. for ch in alpha_phone_number: # Determine if the character is a letter. if ch.isalpha(): # If so, convert the character to uppercase. ch = ch.upper() # Determine the index number for the character # from the digit list. if ch == 'A' or ch == 'B' or ch == 'C': index = 0 elif ch == 'D' or ch == 'E' or ch == 'F': index = 1 elif ch == 'G' or ch == 'H' or ch == 'I': index = 2 elif ch == 'J' or ch == 'K' or ch == 'L': index = 3 elif ch == 'M' or ch == 'N' or ch == 'O': index = 4 elif ch == 'P' or ch == 'Q' or ch == 'R' or ch == 'S': index = 5 elif ch == 'T' or ch == 'U' or ch == 'V': index = 6 elif ch == 'W' or ch == 'X' or ch == 'Y' or ch == 'Z': index = 7 # Set the character to a digit from the list. ch = digit_list[index] # Concatenate the digit to the string. num_phone_number = num_phone_number + ch # Display the phone number's digits. print('The phone number is', num_phone_number) # Call the main function. main()  n o p | L M N Z ` c d ƻ~okcc~Tkh\NhaOJQJ^JaJhjha5hah$haOJQJ^JaJhaOJQJ^JaJhEPha5hFhaOJQJ\^JhuhaOJQJ\^Jh.0ha5 ha5haOJQJ\^JhOJQJ\^JhyYhyYOJQJ\^JhFhFOJQJ\^Jh.0hF5 hhA5 hO5";lm) M N h o p  > ? t gdagdyYgdF    H    K l    + , F M N c d gdyYgdad p u 4h4[\>stgdat7Smn =>u'@ygdyYgda'Aw1g.q$UVgdagdyY+;0/ =!r"r#$%  Oh+'0  < H T `lt|Programming Exercise 3-1 Tony GaddisNormalPeggy Batchelor2Microsoft Office Word@F#@Ͱ@@\y ՜.+,0 hDocumentSummaryInformation8DCompObj rp  Pro Data Systems, Inc. Programming Exercise 3-1 Title  F Microsoft Word 97-2003 Document MSWordDocWord.Document.89qs666666666vvvvvvvvv66666686666666666666666666666666666666666666666666666666hH6666666666666666666666666666666666666666666666666666666666666666662 0@P`p2( 0@P`p 0@P`p 0@P`p 0@P`p 0@P`p 0@P`p8XV~ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@_HmH nH sH tH N`N Normal*$1$ CJKHPJ_HaJmH sH tHDA D Default Paragraph FontViV 0 Table Normal :V 44 la (k ( 0No List NN Heading x$CJOJPJQJ^JaJ6B6  Body Text x(/( List^JH""H Caption xx $6CJ]^JaJ.2. Index $^JHBH hA0 Balloon TextCJOJQJ^JaJZ/QZ hA0Balloon Text Char CJKHOJPJQJ^JaJtHPK![Content_Types].xmlN0EH-J@%ǎǢ|ș$زULTB l,3;rØJB+$G]7O٭VvnB`2ǃ,!"E3p#9GQd; H xuv 0F[,F᚜K sO'3w #vfSVbsؠyX p5veuw 1z@ l,i!b I jZ2|9L$Z15xl.(zm${d:\@'23œln$^-@^i?D&|#td!6lġB"&63yy@t!HjpU*yeXry3~{s:FXI O5Y[Y!}S˪.7bd|n]671. tn/w/+[t6}PsںsL. J;̊iN $AI)t2 Lmx:(}\-i*xQCJuWl'QyI@ھ m2DBAR4 w¢naQ`ԲɁ W=0#xBdT/.3-F>bYL%׭˓KK 6HhfPQ=h)GBms]_Ԡ'CZѨys v@c])h7Jهic?FS.NP$ e&\Ӏ+I "'%QÕ@c![paAV.9Hd<ӮHVX*%A{Yr Aբ pxSL9":3U5U NC(p%u@;[d`4)]t#9M4W=P5*f̰lk<_X-C wT%Ժ}B% Y,] A̠&oʰŨ; \lc`|,bUvPK! ѐ'theme/theme/_rels/themeManager.xml.relsM 0wooӺ&݈Э5 6?$Q ,.aic21h:qm@RN;d`o7gK(M&$R(.1r'JЊT8V"AȻHu}|$b{P8g/]QAsم(#L[PK-![Content_Types].xmlPK-!֧6 0_rels/.relsPK-!kytheme/theme/themeManager.xmlPK-!R%theme/theme/theme1.xmlPK-! ѐ' theme/theme/_rels/themeManager.xml.relsPK]  &  d t 8@0(  6 3 ?H<?JV"ST^adg)'28ADU BKNX  ; M W g 2 <       M Q R T _ a l n   = A B D O Q \ ^  :>?ALNY[fh,<?ORT(/17hn!x}JMOR$FLdgIV  {  / 1 N P  7 < M Q ' , = A w | $):>333333333333333333333333333333333333333333333333333333333333333333pNd^\@~~5'j)94 EyY"\abr,{1~d~Fq5kAbhAadzpE!`.O.0l-@@Unknown G*Ax Times New Roman5Symbol3. *Cx Arial?= *Cx Courier NewO.  k9Lucida Sans UnicodeG=  jMS Mincho-3 fg5. .[`)Tahoma9. ")Segoe UIA$BCambria MathBAhT,;T,;Q,;\y \y !20 3QHP $P@~2!xx Programming Exercise 3-1 Tony GaddisPeggy Batchelor