Covid-19 Tracker Application in Python

Priyalakshmi
4 min readMay 23, 2021

Do you know? In python we can track covid-19 data country wise. Are you surprised after hearing this ?Yes it is true just see here we created a coding for covid-19 tracker.

Reference :https://www.guvi.in/course_login

Here, we are going to create a GUI application to track the COVID-19 cases.

We need to use three different libraries here.

  1. tkinter — for GUI
  2. matplotlib — to show data graphically
  3. covid — to get COVID data

You can install “tkinter” using the pip command given below

"pip install Tk"

You can install “matplotlib” using the pip command given below

"pip install matplotlib"

You can install “covid” using the pip command given below.

"pip install covid"

Type this command in your terminal to install and use this library.

Now let us move on into the code.

So first we are going to import a tkinter and setting some geometry and title.

Next we defining a function which will get covid data and display it . Importing matplotlib and covid library and creating some empty to store different data sets.

Now using try and except to run program without errors.

Next creating a for loop to get all country data

This block is for except section. It will display if the user didn’t enter the correct country name it will throw an exception.

That’s all about our coding.

Output:

Whenever you are doing a project just learn the concepts whatever you use in the code. That will be useful for you to explain your project to someone.

In the above program we have implemented a coding for covid-19 application tracker . In that program we have imported some library function which are available in python , defined a function and used some looping concepts like for loop.

  • Function
  • for loop
  • if else

Function :

A function in python is an aggregation of related statements designed to perform a computational, logical, or evaluation task. The idea is to put commonly or repeatedly done tasks together and make a function so that instead of writing the same code again and again for different inputs, we can call the function to reuse code contained in it over and over again.

Functions can be both built-in or user-defined. It helps the program to be concise, non-repetitive, and organized.

for loop :

For loops are used for sequential traversal. For example: traversing a list or string or array etc. In Python, there is no C style for loop, i.e., for (i=0; i<n; i++). There is “for in” loop which is similar to for each loop in other languages. Let us learn how to use for in loop for sequential traversals.

if else :

The if statement alone tells us that if a condition is true it will execute a block of statements and if the condition is false it won’t. But what if we want to do something else if the condition is false. Here comes the else statement. We can use the else statement with if statement to execute a block of code when the condition is false.

To learn more about python sign in to Guvi

https://www.guvi.in/free-courses

--

--