Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Naming Rules and Conventions | Basics
Introduction to Data Analysis in Python
course content

Kursusindhold

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
Naming Rules and Conventions

There are several rules for naming variables in Python. These are the following:

  • a variable name must start with a letter or the underscore character, which means a variable name can not begin with a number.

  • a variable name may contain only English letters, numbers, and underscore characters.

  • variables names are case sensitive, i.e., Chapter, chapter, and CHAPTER will be considered by Python as three different objects.

question mark

Choose all the acceptable names for variables.

Select the correct answer

Above we considered the 'technical' side of naming variables. At the same time, there are several conventions between programmers on namings. These are:

  • variables names should be in lowercase.

  • variables names containing several words should have words separated by the underscore characters (_).

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

question mark

Choose all the acceptable names for variables.

Select the correct answer

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 7

Spørg AI

expand
ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

course content

Kursusindhold

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
Naming Rules and Conventions

There are several rules for naming variables in Python. These are the following:

  • a variable name must start with a letter or the underscore character, which means a variable name can not begin with a number.

  • a variable name may contain only English letters, numbers, and underscore characters.

  • variables names are case sensitive, i.e., Chapter, chapter, and CHAPTER will be considered by Python as three different objects.

question mark

Choose all the acceptable names for variables.

Select the correct answer

Above we considered the 'technical' side of naming variables. At the same time, there are several conventions between programmers on namings. These are:

  • variables names should be in lowercase.

  • variables names containing several words should have words separated by the underscore characters (_).

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

question mark

Choose all the acceptable names for variables.

Select the correct answer

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 7
Vi beklager, at noget gik galt. Hvad skete der?
some-alt