Countdown Timer Basics

Introduction

Let’s try doing something else. Let’s make a simple timer app that will get a set number of seconds and count down from that!

Components Needed

  • Little Python Brain
  • A tablet/phone/laptop
Steps

1

Importing the sleep library

We need this block to count down each second.

2

Setting the time

We then take the user input of how many seconds they want to count down from.

3

Converting the string to integer

Recall that taking a User_Input returns a string data type. We need to convert this data to integer first. Call this variable setTime.

4

Our countdown loop

We then use another for loop, this time counting down every second from setTime down to 0. 

Every second, it also prints out the seconds remaining.

5

Time's up!

Finally, once the loop is finished, we want to tell the user that. A simple print() block will do the trick!

The Complete Code

Run the code!

Back to: Intermediate > Countdown Timer
© 2020 Little Python

CONTACT US

    Log in with your credentials

    or    

    Forgot your details?

    Create Account