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 trialarielp
3,516 Pointsdef sillycase
Here I am stuck again unable to pass the challenge.
wrd = ["treehouse"]
def sillycase(word):
for word in word:
print word[:4] + word[-5:].upper()
return
sillycase(wrd)
thanks in advance!
2 Answers
mhjp
20,372 PointsNo need to loop here, you can accomplish this with string slicing.
def sillycase(s):
return s[:len(s)//2].lower() + s[len(s)//2:].upper()
Oleksandr Krasnovskyy
3,312 Pointsgot you, makes sense. Appreciate it
arielp
3,516 Pointsarielp
3,516 PointsI see, thanks.
Oleksandr Krasnovskyy
3,312 PointsOleksandr Krasnovskyy
3,312 Pointswhy is it "//"?
mhjp
20,372 Pointsmhjp
20,372 Points// is the floor division operator. It returns the integral part of the quotient.