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
William Brown
1,303 Pointscheck this out i was pretty lazy so i offered pc to play with pc wish they truly dumb
import random user_number = random.randint(1,10) while 1:
comp_guess = random.randint(1,10)
user_guess = "Guess again" user_guess_h = "Guess higher" user_guess_l = "Guess lower" user_resp = random.choice(("You Got it!","Your pretty smart computer"))
if user_number == comp_guess: print(user_resp) print("My Number was: %d"%user_number) print("Comp guess is: %d\n"%comp_guess)
break
elif user_number < comp_guess:
print("Comp guess is: %d"%comp_guess)
print("User guess is: %d"%user_number)
print(user_guess_l+"\n")
elif user_number > comp_guess:
print("Comp guess is: %d"%comp_guess)
print("User guess is: %d"%user_number)
print(user_guess_h+"\n")
else: print(user_guess)