Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Device Boots Count | Scopes
Mastering Python: Closures and Decorators
course content

Contenido del Curso

Mastering Python: Closures and Decorators

Mastering Python: Closures and Decorators

1. Scopes
2. Closure
3. Decorators

Challenge: Device Boots Count

Tarea

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.

  1. Define the boots variable in the global scope.
  2. Make changeable the boots global variable inside the boot() function local scope.
  3. Increase the boots variable by 1 inside the boot() function.
  4. If the device is booting for the first time, display a message:
    "The device boot for the first time".
  5. If the device is booting 2+ times, display a message: "The device boot N times", where N is a boots variable.

Tarea

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.

  1. Define the boots variable in the global scope.
  2. Make changeable the boots global variable inside the boot() function local scope.
  3. Increase the boots variable by 1 inside the boot() function.
  4. If the device is booting for the first time, display a message:
    "The device boot for the first time".
  5. If the device is booting 2+ times, display a message: "The device boot N times", where N is a boots variable.

¿Todo estuvo claro?

Sección 1. Capítulo 5
toggle bottom row

Challenge: Device Boots Count

Tarea

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.

  1. Define the boots variable in the global scope.
  2. Make changeable the boots global variable inside the boot() function local scope.
  3. Increase the boots variable by 1 inside the boot() function.
  4. If the device is booting for the first time, display a message:
    "The device boot for the first time".
  5. If the device is booting 2+ times, display a message: "The device boot N times", where N is a boots variable.

Tarea

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.

  1. Define the boots variable in the global scope.
  2. Make changeable the boots global variable inside the boot() function local scope.
  3. Increase the boots variable by 1 inside the boot() function.
  4. If the device is booting for the first time, display a message:
    "The device boot for the first time".
  5. If the device is booting 2+ times, display a message: "The device boot N times", where N is a boots variable.

¿Todo estuvo claro?

Sección 1. Capítulo 5
toggle bottom row

Challenge: Device Boots Count

Tarea

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.

  1. Define the boots variable in the global scope.
  2. Make changeable the boots global variable inside the boot() function local scope.
  3. Increase the boots variable by 1 inside the boot() function.
  4. If the device is booting for the first time, display a message:
    "The device boot for the first time".
  5. If the device is booting 2+ times, display a message: "The device boot N times", where N is a boots variable.

Tarea

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.

  1. Define the boots variable in the global scope.
  2. Make changeable the boots global variable inside the boot() function local scope.
  3. Increase the boots variable by 1 inside the boot() function.
  4. If the device is booting for the first time, display a message:
    "The device boot for the first time".
  5. If the device is booting 2+ times, display a message: "The device boot N times", where N is a boots variable.

¿Todo estuvo claro?

Tarea

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.

  1. Define the boots variable in the global scope.
  2. Make changeable the boots global variable inside the boot() function local scope.
  3. Increase the boots variable by 1 inside the boot() function.
  4. If the device is booting for the first time, display a message:
    "The device boot for the first time".
  5. If the device is booting 2+ times, display a message: "The device boot N times", where N is a boots variable.

Sección 1. Capítulo 5
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt