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 Basics Functions and Looping Functions

what 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")
Cameron-Lee Rothenburg
Cameron-Lee Rothenburg
4,415 Points

I believe you are setting a variable called yell. You need to call a function.

yell("text to shout")

thanks. i will try

2 Answers

def 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

I 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