Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDustin Jasmin
3,156 PointsWhat is wrong here?
I turned the argument into a list, made a slice for the first part of it and the last part of it, then I lowercased the first part and uppercased the second part. Then I added both lists together and used the join function to bring them together
def sillycase(item):
item_into_list = list(item)
first_half_of_list = item_into_list[:len(item_into_list) // 2)]
second_half_of_list = item_into_list[int(len(item_into_list)) // 2:]
new_first_half_list = first_half_of_list.lower()
new_second_half_of_list = secomf_half_of_list.upper()
new_list = new_first_half_list + new_second_half_of_list
put_them_together = "".join(new_list)
return put_them_together
1 Answer
Chris Freeman
Treehouse Moderator 68,457 PointsYou have flow correct. There are three errors to correct:
- by converting
item
into a list, you lose the ability to use the string methods.lower()
and.upper()
. Instead, leaveitem
as a string. The slices will work the same on a string as they do on a list - there is an extra closing paren in line 3
- there is a typo.
secomf
should besecond
Post back if you need more help. Good luck!!