Good programming practices to create classes, methods, and variables. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Good programming practices to create classes, methods, and variables.

Im new, and in the code, when I see a class, the class start with uppercase, for example "MyClass". but in the methods and variables are the same? Is this a rule or something that You need to follow?

13th Nov 2016, 1:13 AM
edu
edu - avatar
1 Answer
+ 3
There are very few rules when it comes to naming, but here are the guidelines: Variables/functions: num, width, height, isOnGround, is_prime Classes: Student, Person, Car Constants: PI, NAME, AVOGARDO These aren't required, however, it just makes for good programming style. What will cause an error: 123abc (starts with a number) my var (has a space) print (it's a reserved keyword) n
quot;# (special characters, not including underscore) And, also, names cannot be longer than 255 characters, but it's strongly recommended to stay under 32.
13th Nov 2016, 1:27 AM
Keto Z
Keto Z - avatar