Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Naming Conventions | Variables
Introduction to Python | Mobile-Friendly

bookNaming Conventions

We considered the 'technical' side of naming variables in the previous chapter. At the same time, there are several conventions among programmers in regard to naming. These are:

  • Variables’ names should be lowercase.
  • For variables’ names that contain several words, we should separate these words with the underscore characters (_).

These rules are not compulsory, but they are recommended. For example, if you need to store the number of a user's points, it will be much better to use points, num_of_points, or n_points instead of n, p, or something like that.

question mark

Choose the most appropriate choices for meaningful variable names that satisfy the abovementioned conventions.

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 3

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Suggested prompts:

Posez-moi des questions sur ce sujet

Résumer ce chapitre

Afficher des exemples du monde réel

Awesome!

Completion rate improved to 4

bookNaming Conventions

Glissez pour afficher le menu

We considered the 'technical' side of naming variables in the previous chapter. At the same time, there are several conventions among programmers in regard to naming. These are:

  • Variables’ names should be lowercase.
  • For variables’ names that contain several words, we should separate these words with the underscore characters (_).

These rules are not compulsory, but they are recommended. For example, if you need to store the number of a user's points, it will be much better to use points, num_of_points, or n_points instead of n, p, or something like that.

question mark

Choose the most appropriate choices for meaningful variable names that satisfy the abovementioned conventions.

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 3
some-alt