Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Automated Bus Announcements | Function Return Value Specification
Python Functions Tutorial
course content

Contenuti del Corso

Python Functions Tutorial

Python Functions Tutorial

1. What is a Function in Python?
2. Positional and Optional Arguments
3. Arbitrary Arguments
4. Function Return Value Specification
5. Recursion and Lambda Functions

book
Challenge: Automated Bus Announcements

Compito

Swipe to start coding

If you've ever ridden a bus or tram, you know that station announcements are pre-recorded and cycle continuously. Implement a generator function bus_announcements to simulate an automated bus announcement system.

  1. Use an infinite loop to cycle through the stops continuously.
  2. Iterate over each stop in the stops list.
  3. Use yield to return the current stop in the format "Next stop: {stop}".

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 5
toggle bottom row

book
Challenge: Automated Bus Announcements

Compito

Swipe to start coding

If you've ever ridden a bus or tram, you know that station announcements are pre-recorded and cycle continuously. Implement a generator function bus_announcements to simulate an automated bus announcement system.

  1. Use an infinite loop to cycle through the stops continuously.
  2. Iterate over each stop in the stops list.
  3. Use yield to return the current stop in the format "Next stop: {stop}".

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 5
Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt