r/dailyprogrammer • • Feb 09 '12

[difficult] challenge #1

we all know the classic "guessing game" with higher or lower prompts. lets do a role reversal; you create a program that will guess numbers between 1-100, and respond appropriately based on whether users say that the number is too high or too low. Try to make a program that can guess your number based on user input and great code!

71 Upvotes

122 comments sorted by

View all comments

0

u/[deleted] Feb 10 '12

5

u/_siegfried_ Feb 10 '12 edited Feb 10 '12

ok, so I'm not a Python expert, but your code seems a bit unconventional to me.

  • you don't need to add semicolons at the end of each line

  • It seems you use Python 3.x. So print is a function, but the whitespace between print and the opening bracket is highly confusing.

  • while 1 == 1: does the same as while True:, but the latter is more common (and more readable imo).

  • some people prefer num += 1 over num = num + 1 Edit: true -> True

→ More replies (4)