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 trial

Python Python Collections (2016, retired 2019) Tuples Stringcases

Dylan Jackson
PLUS
Dylan Jackson
Courses Plus Student 1,906 Points

String Cases

I'm getting really perturbed by how these grading scripts are working. I test this in IDLE and the Python shell will run it fine, and return the proper strings.

Sample output from the function:

string = 'giant apple' stringcases(string) ('giant apple', 'GIANT APPLE', 'giant apple', 'Giant Apple', 'elppa tnaig')

stringcases.py
def stringcases(string):
    orig = string
    upper = orig.upper()
    lower = orig.lower()
    title = orig.title()
    reverse = orig[::-1]
    data = (orig, upper, lower, title, reverse)
    return data
Dylan Jackson
Dylan Jackson
Courses Plus Student 1,906 Points

Never mind, I did a dumb... I returned the original when it isn't requested.

u can just return return upper, lower, title, reverse in place of creating data.

1 Answer