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 trialHoessein Abd
Python Web Development Techdegree Graduate 19,107 PointsWhat is this function doing and do i have to use it in the while loop?
def even_odd(num):
return not num % 2
while start:
random = random.randint(1, 99)
if random % 2 == 0:
print("{} is even").format(random)
else:
print("{} is odd").format(random)
start -= 1
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsYou do not have to use the provided helper function. It's included for your convenience.
Two errors observed in your code:
- the
format
method needs to be applied directly to the string. Currently it's outside the print statement - you are over writing the
random
module by assigning the result ofrandint
bank torandom
Post back if you need more help. Good luck!!!
Hoessein Abd
Python Web Development Techdegree Graduate 19,107 PointsHoessein Abd
Python Web Development Techdegree Graduate 19,107 PointsThanks!