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 My Solution

Different Working Solution So below is the code I used and it ran just like the video. Did I over complicate this?

# TODO: Prompt the user for parts of speech and store them in variables
verb = input("Please enter a verb: ")
noun = input("Please enter a noun: ")
adjective = input("Please enter a adjective: ")
# TODO: Output the template to the screen with the blanks filled out with what the user stated
print("I enjoy practice! I find it helps me to {} better.".format(verb))
print("Without practice, my {} would probably not even work.".format(noun))
print("My code is getting more {} every single day!".format(adjective))

[MOD: added ```python formatting -cf]

2 Answers

Johnathan Van Vliet
Johnathan Van Vliet
2,550 Points

No, you did not overcomplicate it. You simply used a different way to format the code.

The video wanted you to use string concatenation instead of .format. To do that, you would do this:

# TODO: Prompt the user for parts of speech and store them in variables
verb = input("Please enter a verb: ")
noun = input("Please enter a noun: ")
adjective = input("Please enter a adjective: ")

# TODO: Output the template to the screen with the blanks filled out with what the user stated
print("I enjoy practice! I find it helps me to", verb, "better.")
print("Without practice, my", noun, "would probably not even work.")
print("My code is getting more", adjective, "every single day!")

So, did you overcomplicate it? Not at all. In fact, I think that using .format, in this case, makes the code look nicer and easier to write.

datavxn
datavxn
16,180 Points

I wrote mine different than both of these and it worked perfect:

verb = input("Enter a verb here: ")

noun = input("Enter a noun here: ")

adjective = input("Enter an adjective here: ")

print("I enjoy practice! I find it helps me to {} better.\nWithout practice, my {} would probably not even work.\nMy code is getting more {} every single day!".format(verb, noun, adjective))

treehouse:~/workspace$ python madlibs.py
Enter a verb here: think
Enter a noun here: writing
Enter an adjective here: advanced
I enjoy practice! I find it helps me to think better.
Without practice, my writing would probably not even work.
My code is getting more advanced every single day!

definately clever.Thumbs up from me