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 trialTyler Duvall
Python Development Techdegree Graduate 11,791 PointsWhat's wrong with this code? I wrote it out exactly just like the instructor did in my course and his worked.
praise = "You are doing great" praise = praise.upper() number_of_characters = len(praise) result = + "!" * number_of_characters print(praise)
when I run it in the console it comes back with this error:
Traceback (most recent call last):
File "/home/treehouse/workspace/notifications.py", line 4, in <module>
result = + "!" * number_of_characters
TypeError: bad operand type for unary +: 'str'
1 Answer
Megan Amendola
Treehouse TeacherLook like you need to move your + symbol. Instead of result = + "!" * number_of_characters
, you should have result += "!" * number_of_characters
.
+= adds the !s and then sets the variable to include your new addition, the !s.