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 trialjustin behringer
Python Development Techdegree Student 6,245 PointsIs my solution the same?
verb = input("Name a verb: ")
noun = input("Name a Noun: ")
adjective = input("Name a adjective: ")
template = ("I enjoy practice! I find it helps me to {} better. Without practice, my {} would probably not even work. My code is getting more {} every single day".format(verb, noun, adjective))
print(template)
All feedback is welcome!
Jordan young
Courses Plus Student 5,277 PointsIt is not the same because you had the great idea of making the template in the notes a variable by it self. Really smart of you and low-key and lazy but excellent solution (i'm jealous of it)!
Craig just used multiple print statements on their own.
Good job!
4 Answers
Benyamin Kohanchi
Courses Plus Student 2,342 PointsYour code is very similar to Craig's code and it is still correct. Craig used a longer but a more understandable route (for beginners) in writing his code. You, on the other hand, took advantage of .format which Craig taught you early on to make it quicker for yourself.
Well done!
Marisa Blanco
5,358 PointsI did mine very similarly to yours. I didn't find this practice video until making it all the way to Lists but I tried to take what I've learned through Lists and keep as condensed code as possible.
verb = input("Please enter a verb: ")
noun = input("Please enter a noun: ")
adjective = input("Please enter an adjective: ")
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))
erilope
Courses Plus Student 364 PointsDoes Craig go over this type of stuff later on?
Marisa Blanco
5,358 PointsYes, he does. I was able to come up with this code after completing Python Basics and venturing into Lists.
Jeffery Jones
2,769 Pointsit does the same thing so good job thinking outside the box! only difference is Craig's looks a little cleaner bc it's on 3 separate lines when you run the madlib in the code. nice work
Michael HK
Python Development Techdegree Student 304 PointsA way to make it visually clean to see three separate lines for the body paragraph, you can just do a line break within the print() function, still using f-string. An IDE like PyCharm will auto-fill the f"" when you hit enter to make a new line while still in the print() function.
verb = input("Enter a verb: ")
noun = input("Enter a noun: ")
adjective = input("Enter an adjective: ")
print(f"I enjoy practice! I find it helps me to {verb} better.\n"
f"Without practice, my {noun} would probably not even work.\n"
f"My code is getting more {adjective} every single day!")
Sumiya Malik
3,976 PointsSOL 1:
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 an adjective : ")
TODO: Output the template to the screen with the blanks filled out with what the user stated
print(f" I enjoy practice! I find it helps me to {verb} better. Without practice, my {noun} would probably not even work. My code is getting more {adjective} every single day!")
SOL 2:
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 an 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. Without practice, my", noun," would probably not even work. My code is getting more", adjective, "every single day!")
Pratham Mishra
14,191 PointsPratham Mishra
14,191 Pointsyour code looks pretty decent and would do god enough to do the job. For a beginner this is excellent. If you would like to make few advancements to this code. You could use f-string instead of format. Which will look something like this:
template = (f"I enjoy practice! I find it helps me to {verb} better. Without practice, my {noun} would probably not even work. My code is getting more {adjective} every single day".)
This will make your code clean and easy to read. I'm not sure if you are already familiar with this, this is known as f-string. I hope this was some help.