String & List tracing
What will print out when you run the following functions?
def listIt():
list = []
for i in range(1, 11, 2):
list.append(i)
string = "cHEcK"
for index in range(len(string)):
if string[index].isupper():
list[index] = string[index]
print "The string is", string
print "The list is", list
##################################################
def change1():
source = "Georgia Institute of Technology"
vowels = "aeiou"
source = source.lower()
for letter in vowels:
loc = source.find(letter)
if loc <> -1:
source = source[:loc] + source[loc + 1:]
print source
Links to this Page