Challenge: Creating User Profile & Activity Details
Task
Swipe to start coding
You're developing a user profile and activity tracker for a website. Complete the program by following the steps below:
- Declare a constant called
DEFAULT_COUNTRYwith the value"United States". - Declare a variable
usernameand assign it"John Doe". - Declare a variable
ageand set it to30. - Declare a variable
countryand set it equal toDEFAULT_COUNTRY. - Declare a variable
isSubscribedand set it totrue. - Declare a variable
loginCountand set it to5. - Declare a variable
loginRewardand set it to250. - Then perform the following updates:
- Increment the value of
loginCountusing the++operator. - Increase
loginRewardby50using the+=operator.
- Increment the value of
- Finally: create a variable
welcomeMessagethat joins the following values using the+operator:username" is "age" years old and has logged in "loginCount" times. The Login Reward balance is "loginReward
- Output the
welcomeMessage.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 15
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: Creating User Profile & Activity Details
Swipe to show menu
Task
Swipe to start coding
You're developing a user profile and activity tracker for a website. Complete the program by following the steps below:
- Declare a constant called
DEFAULT_COUNTRYwith the value"United States". - Declare a variable
usernameand assign it"John Doe". - Declare a variable
ageand set it to30. - Declare a variable
countryand set it equal toDEFAULT_COUNTRY. - Declare a variable
isSubscribedand set it totrue. - Declare a variable
loginCountand set it to5. - Declare a variable
loginRewardand set it to250. - Then perform the following updates:
- Increment the value of
loginCountusing the++operator. - Increase
loginRewardby50using the+=operator.
- Increment the value of
- Finally: create a variable
welcomeMessagethat joins the following values using the+operator:username" is "age" years old and has logged in "loginCount" times. The Login Reward balance is "loginReward
- Output the
welcomeMessage.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 15
single