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 trialaravind vemperala
651 PointsHelp needed on task
def printer((count)): h="hi " count=int(count) print(h*count) works fine in work space but not in quiz
def printer((count)):
h="hi "
count=int(count)
print(h*count)
2 Answers
Haider Ali
Python Development Techdegree Graduate 24,728 PointsHi there Aravind, although your solution isn't as simple as it could be, there are a couple of things you should do to make it pass. Firstly, 2 sets of parens aren't required around your count
argument. Furthermore, in your string, hi should have a capital letter:
def printer(count):
h="Hi "
count=int(count)
print(h*count)
Although this would make the challenge pass, it is not how i would recommend doing it as it goes through unnecessary steps. I would recommend to not assign 'Hi ' to a variable and also leave out int(count)
since we know that the count
argument is already going to be an integer:
def printer(count):
print("Hi " * count)
If you have any further questions, please feel free to leave a comment :)
Thanks,
Haider
aravind vemperala
651 PointsThank you