I am having trouble writing a variable named UpperCaseSentence outside of a for loop in this particular code snippet. It runs fine while in the loop but not while out of the loop. Can anyone shed some light on this dilemma for me. Here is the code.
Thank you a bunch.
#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()