Challenge: Device Boots Count
Uppgift
Swipe to start coding
Imagine that you work in a company that produces devices. You have been tasked with developing a function that will count the number of boots on this device: with each boot, the device must increase the number of boots by 1.
- Define the
boots
variable in the global scope. - Make changeable the
boots
global variable inside theboot()
function local scope. - Increase the
boots
variable by 1 inside theboot()
function. - If the device is booting for the first time, display a message:
"The device boot for the first time"
. - If the device is booting 2+ times, display a message:
"The device boot N times"
, where N is aboots
variable.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 5
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Suggested prompts:
Sammanfatta detta kapitel
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 6.67
Challenge: Device Boots Count
Svep för att visa menyn
Uppgift
Swipe to start coding
Imagine that you work in a company that produces devices. You have been tasked with developing a function that will count the number of boots on this device: with each boot, the device must increase the number of boots by 1.
- Define the
boots
variable in the global scope. - Make changeable the
boots
global variable inside theboot()
function local scope. - Increase the
boots
variable by 1 inside theboot()
function. - If the device is booting for the first time, display a message:
"The device boot for the first time"
. - If the device is booting 2+ times, display a message:
"The device boot N times"
, where N is aboots
variable.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Awesome!
Completion rate improved to 6.67Avsnitt 1. Kapitel 5
single