Hi Python Tutor, I have a write a simple function named 
"SwapCaseAndCenter(a_string, width). The idea is to use the function swapcase 
and center so that when the userenters a string it centers it and swaps the 
case (e.g. upper to lower and vice versa).  The function calls for passing in 
two variables "a_string, width" but I am still confused on this concept.  In my 
code below I seem to be able to pass in the variable "a_string" and found out 
how to use the "center along with swapcase" functions. I am still unsure howto 
pass in the variable "width". In my code I have hard coded the centering but I 
am not sure if instead I use the variable width to determine the centering. Any 
suggestions, help or examples of how to do this is appreciated.  
def SwapCaseAndCenter(a_string):    while True: 
        a_string=raw_input("give me a word: (enter to quit): ")     
        if a_string:
            print a_string.center(60).swapcase()
        elif not a_string:
            print "you did not provide a word. goodbye"
        break SwapCaseAndCenter(a_string)
Thanks, Dan                                       
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to