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

#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()

<<attachment: electrical.vcf>>

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

Reply via email to