Algorithm it, and look at the instance below the function first where
variables are drawn in as raw input, and comments with # are just
comments, not part of the code:


def SwapCaseAndCenter(a_string, upper_or_lower = None):

#find if it's upper, and print

        if upper_or_lower == "upper":
                print a_string.center(center_num).upper()

#find if it's upper, and print

        if upper_or_lower == "lower":
                print a_string.center(center_num).lower()




#Instance of function SwapCaseAndCenter vars input
#define the string to be upper/lower cased and centered at a particular point

a_string = raw_input("Give me a word, or letter: ")

#define if it's upper or lower

upper_or_lower = raw_input("upper, or lower character(s): ")

#define where it should be centered with an int cast

center_num = int(raw_input("Where should number be centered?: "))

#call the function with the params, and look above to the function
SwapCaseAndCenter(a_string, upper_or_lower)


-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to