On 7/1/2012 2:50 PM Jim said...
Hello Friends,
I apologize for being such a bother. This problem has been evading me
all day. Can you please give me a hint as to why I cannot put the
variable UpperCaseSentence outside of the for loop?
I can do it in other instances but not in this one.
Thank you so much,
Jim



You're not returning anything from fixCase -- change the final print to return and try it again.

Emile




#Main function.
def main():
    mySentence = (input("Enter text."))
    mySentenceList = mySentence.split('.')

    #Call fixCase function. Send it mySentenceList and receive result
    #and stores result in variable named output.
    output = fixCase(mySentenceList)
    print(output)

def fixCase(myList):
    #Begin making a loop through the list, using a variable myString
    for myString in range (len(myList)):
        tempString = myList[myString] #Store in temporary variable.
        myList[myString] = tempString[0:1].upper() + 
tempString[1:len(tempString)] #Replace with upper
        UpperCaseSentence = (myList[myString])
        print(UpperCaseSentence)

#Call main function
main()


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to