- #1
zeion
- 466
- 1
Homework Statement
I'm supposed to write a function that does this:
def capitalize_items_2(lst):
Return a new list with the same items as lst, only in upper case. lst is a list of strings. This function does not change lst
Homework Equations
The Attempt at a Solution
def capitalize_items_2(lst):
lst2=[]
i=0
for x in lst:
lst2.append(lst.upper())
i+=1
return lst2
But how come I can't define lst2 inside the function and return it?
Do I need to define it outside or is there a better way?
Thanks.