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 trialreza sajadian
718 Pointsa tuple of lowered, uppered, titlecased, and reversed string
Hi. my code doesnt seem like working in this century. I need some help please.
def split(string): string_list = string.split() return string_list
def uppercased(string_split): uppered = string_split.upper() return uppered
def lowercased(string_split): lower = string_split.lower() return lower
def titlecased(string_split): titlecased = string_list.title() return titlecased
def reverse(string_split): reverse = string_split[::-1] return reverse
def stringcases(string): a = uppercased() b = lowercased() c = titlecased() d = reverse() tuple(a, b, c, d) return (a, b, c, d)
# Handy functions:
# .upper() - uppercases a string
# .lower() - lowercases a string
# .title() - titlecases a string
# There is no function to reverse a string.
# Maybe you can do it with a slice?
def split(string):
string_list = string.split()
return string_list
def uppercased(string_split):
uppered = string_split.upper()
return uppered
def lowercased(string_split):
lower = string_split.lower()
return lower
def titlecased(string_split):
titlecased = string_list.title()
return titlecased
def reverse(string_split):
reverse = string_split[::-1]
return reverse
def stringcases(string):
a = uppercased()
b = lowercased()
c = titlecased()
d = reverse()
tuple(a, b, c, d)
return (a, b, c, d)
3 Answers
Emily Peregrine
16,848 PointsYou're not passing the string to a,b,c,d
def split(string):
string_list = string.split()
return string_list
def uppercased(string_split):
uppered = string_split.upper()
return uppered
def lowercased(string_split):
lower = string_split.lower()
return lower
def titlecased(string_split):
titlecased = string_list.title()
return titlecased
def reverse(string_split):
reverse = string_split[::-1]
return reverse
def stringcases(string):
a = uppercased(string)
b = lowercased(string)
c = titlecased(string)
d = reverse(string)
return (a, b, c, d)
reza sajadian
718 PointsThank you all. Helpful.
tomasvukasovic
24,022 PointsSomeone should close this thread Chris Freeman
Chris Freeman
Treehouse Moderator 68,457 PointsHi Tomas, not sure what you mean by 'close'? Perhaps you meant mark as Best Answer? Threads are always open for further comments and posts including after being marked Best Answer.
tomasvukasovic
24,022 Pointstomasvukasovic
24,022 PointsYou don't need the parenthesis at the last return, but I would agree with the answer
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsIn addition to not passing the
string
argument to the function calls instringcases()
, as mentioned by Emily, there is a syntax error intitlecased()
."
string_list
" should be replaced with the defined parameter "string_split
"