Challenge: Declaring & Using Constants
Swipe to start coding
You're building a subscription management system for a new streaming service. The program calculates the total subscription cost based on:
- The number of devices a user has.
- A fixed monthly price.
Your task:
Declare a constant called MONTHLY_PRICE and assign it the value 9.99.
The constant should then be used to calculate the total subscription cost.
Note
In most programming languages, constants are typically written in all uppercase letters, with words separated by underscores (
_). This naming convention helps differentiate constants from regular variables and makes them easier to recognize in code.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.35
Challenge: Declaring & Using Constants
Swipe to show menu
Swipe to start coding
You're building a subscription management system for a new streaming service. The program calculates the total subscription cost based on:
- The number of devices a user has.
- A fixed monthly price.
Your task:
Declare a constant called MONTHLY_PRICE and assign it the value 9.99.
The constant should then be used to calculate the total subscription cost.
Note
In most programming languages, constants are typically written in all uppercase letters, with words separated by underscores (
_). This naming convention helps differentiate constants from regular variables and makes them easier to recognize in code.
Solution
Thanks for your feedback!
single