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 trialCaleb Newell
12,562 Pointswhat is wrong with my code. and how do i fix it?
def yell(text):
text = text.upper()
number_of_characters = len(text)
result = text + "!" * (number_of_characters // 2)
print(result)
yell = ("You are doing great")
yell = ("Don't forget to ask for help")
yell = ("Don't Repeat Yourself. Keep things DRY")
Caleb Newell
12,562 Pointsthanks. i will try
2 Answers
Cameron-Lee Rothenburg
4,415 PointsYour welcome
Savious Munyaradzi Ngundu
16,920 Pointsdef yell(text): text = text.upper() number_of_characters = len(text) result = text + "!" * (number_of_characters // 2) print(result)
it should be like that, omit 4 spaces after creating a function
Andrea Shyti
374 PointsI am having the same issue, and I can not figure it out what to do. This is the message that I get: code line: def yell(text): text = text.upper() number_of_characters = len(text) result = text + "!" + ((number_of_characters) / 4) print(result)
yell("You are doing great!")
yell("Don't forget to ask for help!")
yell("Don't repeat yourself. Keep things DRY")
TypeError: unsupported operand type(s) for //: 'int' and 'str'
treehouse:~/workspace$ python notifications.py
Traceback (most recent call last):
File "/home/treehouse/workspace/notifications.py", line 8, in <module>
yell("You are doing great!")
File "/home/treehouse/workspace/notifications.py", line 4, in yell
result = text + "!" + ((number_of_characters) / 4)
TypeError: can only concatenate str (not "float") to str
can someone tell me how to get around this issue?...thanks
Cameron-Lee Rothenburg
4,415 PointsCameron-Lee Rothenburg
4,415 PointsI believe you are setting a variable called yell. You need to call a function.
yell("text to shout")