151k views
3 votes
Declare a constant MONTHS_IN_DECADE, whose value is the value of the constant MONTHS_IN_YEAR (already declared) multiplied by 10.

1 Answer

0 votes

Answer:

The solution code is written in Python:

  1. MONTHS_IN_YEAR = 12
  2. MONTHS_IN_DECADE = MONTHS_IN_YEAR * 10

Step-by-step explanation:

Constant variable is a type of variable that holds value which will not be changed. This means the value will only be assigned to the constant variable once. As a convention, constant variable is named with all uppercase letters to differentiate it from other variables.

By presuming there is a constant variable, MONTHS_IN_YEAR which has been declared and assigned with 12 (Line 1).

Next, we create another constant variable, MONTHS_IN_DECADE, and we can calculate the decade by using the value of constant variable MONTHS_IN_YEAR multiplied with 10 and assign the result to MONTHS_IN_DECADE (Line 2).

User Praveen Ramalingam
by
4.3k points