ynonp / python-examples-verint-2016-07

Python examples and exercises
MIT License
2 stars 35 forks source link

Frequently Appeared Comments #54

Open ynonp opened 8 years ago

ynonp commented 8 years ago

Hi All,

Below you'll find some common mistakes we found in many of the submitted solutions. Please take the extra moment to read and improve going forward.

This is an open issue so feel free to add your tips to the group.

Comment & Documentation

  1. Leaving Docstring: In each starter file you have a top docstring (the text inside """) that described the exercise. Please have a top docstring in each submitted solution and in each file you write. That helps others, including your future selves, understand what the script does.
  2. Use line comments (line starting with a #) to describe cool things you've implemented in the solution and tell us why they're cool.

    Python Style

  3. Use for loop when you know the number of iterations. Use while loop when number of iterations can vary or not known in advance.
  4. Use all lowercase names for variables and functions. Better yet go read PEP8 (official python style guide) and use everything from there: https://www.python.org/dev/peps/pep-0008/
  5. Write all import statements at the top of the file, after the docstring.
  6. Prefer str.format over string concatenation
  7. Use descriptive variable names. Instead of number1, x, you could use hidden_number, guess, total.
  8. range (0,7) can be written as range (7)
  9. Use raw_input("Prompt: ")

instead of

print "Prompt: "
raw_input()

Questions: