0% found this document useful (0 votes)
37 views2 pages

Lab 6 - An Acronym Generator

The document provides instructions for writing a Python program to take a string from the user and output the acronym by capitalizing the first letter of each word. It outlines 8 steps to prompt the user, initialize an accumulator string, split the input into a list, iterate over the list to concatenate the first letters, convert to uppercase, and define a function to call. The student is asked to write the function and include it in a module to turn in.

Uploaded by

dumbledoreaaaa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views2 pages

Lab 6 - An Acronym Generator

The document provides instructions for writing a Python program to take a string from the user and output the acronym by capitalizing the first letter of each word. It outlines 8 steps to prompt the user, initialize an accumulator string, split the input into a list, iterate over the list to concatenate the first letters, convert to uppercase, and define a function to call. The student is asked to write the function and include it in a module to turn in.

Uploaded by

dumbledoreaaaa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

CS 170 Section _03_ Lab 6 An Acronym Generator

Name_Mayre Mercedes Jenkins_

Due: No later than the beginning of class, Wed. 10/3/12 Reca !rom t"e c ass t"e #ro$ram %e %rote to decode a se&'ence o! ASC(( n'mbers into t"e strin$ t"at t"e n'mbers re#resent) *e %ant to %rite a simi ar #ro$ram t"at %i #rom#t t"e 'ser !or a strin$ and t"en #rint o't t"e acronym !or t"e strin$) +An acronym is a %ord !ormed !orm t"e !irst etters o! eac" %ord o! a #"rase), -or e.am# e/ i! t"e 'ser in#'ts t"e strin$ 0b'siness1 acco'ntin$ de#artment0/ t"e o't#'t o! yo'r #ro$ram s"o' d be t"e strin$ 02A30) 4"e acronym s"o' d be #rinted 'sin$ ca#ita etters) 5ere is t"e a $orit"m %e %i 'se6 Ste# 1, Ste# 8, Ste# 3, Ste# :, Ste# ;, Ste# 6, Ste# 7, 1, 7rom#t t"e 'ser to enter a strin$) (nitia i9e an acc'm' ator strin$ S# it t"e strin$ into a ist o! strin$s Loo# once !or eac" strin$ in t"e ist 7aste t"e !irst etter o! t"e c'rrent strin$ !rom t"e ist onto t"e acc'm' ator strin$ Con<ert t"e strin$ to ca#ita etters 7rint o't t"e strin$ containin$ t"e acronym)

*rite a 7yt"on statement t"at %i #rom#t t"e 'ser to enter a strin$ and store it in an a##ro#riate y named <ariab e) Destr = input( Please enter your desired phrase/title to acronym-ate:) *Destr= Desired String *Acronymate: he act o! turning a phrase or title into an acronym" #y: $ercedes %en&ins"

8,

*rite a 7yt"on statement to initia i9e a strin$ <ariab e so t"at it contains no c"aracters) accu =

3,

*rite a 7yt"on statement t"at %i take t"e strin$ in#'t by t"e 'ser/ s# it it into a ist o! strin$s and store it in anot"er <ariab e) Make s're t"e <ariab e is named a##ro#riate y) listrings = Destr"split( )

:,

*rite a 7yt"on oo# t"at %i iterate o<er eac" strin$ in t"e ist yo' created in ste# 3) 2e s're to 'se an a##ro#riate y named <ariab e !or t"e oo# inde.) !or phrastring in listrings():

;,

As yo'r 7yt"on oo# iterates o<er eac" strin$ in t"e ist/ yo' %ant to e.tract t"e !irst etter o! t"e c'rrent strin$ !rom t"e ist and concatenate it to t"e acc'm' ator <ariab e) *rite an assi$nment

statement t"at e.tracts t"e !irst etter o! t"e strin$ stored in t"e oo# inde. and stores it in a <ariab e) !irst = phrastring'() 6, *rite an assi$nment statement t"at takes t"e etter stored in t"is <ariab e and concatenates it on t"e end o! t"e acc'm' ator strin$) acro*in = acro*in+!irst 7, *"ic" 7yt"on strin$ ibrary !'nction con<erts t"e c"aracters in a strin$ to '##er case= "upper() >, Assemb e a t"e statements !rom ste#s 1 t"ro'$" 7 into a !'nction t"at !inds and #rints a##ro#riate y abe ed acronyms %it" t"e acronym in a '##er case etters) Ca yo'r !'nction 0acronym_maker")

What to turn in: *"en yo' "a<e !inis"ed %it" yo'r !'nction/ sa<e t"e mod' e as 0acronym_maker.py0 and r'n t"e !'nction se<era times 'nti yo' are certain t"at it %orks correct y) 4"en/ #rint o't a co#y o! t"e mod' e t"at contains t"e !'nction/ sta# e it 'nderneat" t"is ab s"eet/ %rite yo'r name at t"e to# o! t"e ab s"eet and t'rn it in) No #rinted mod' e o't#'t is re&'ired)

You might also like