Get COVID Information Using Python

Get COVID Information Using Python

Python community has made a library to Get COVID Information Using Python

Library is"covid" and it’s so simple to use.

You can download it using the pip command given below.

"pip install covid"

Note: python >= 3.6

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

Visit this site for more details about this library.

Now let’s see and understand the code.


Code

# importing the library
from covid import Covid
# initializing
covid = Covid()
# printing data for the world
print("Total active cases in world:", covid.get_total_active_cases())
print("Total recovered cases in world:", covid.get_total_recovered())
print("Total deaths in world:", covid.get_total_deaths())
# getting data according to country name
# data will be stored as a dictionary
cases = covid.get_status_by_country_name("us")
# printing country's data using for loop
for x in cases:
    print(x, ":", cases[x])

If you are facing any error in your code just copy the code from our website and try to run it again.

Output – Get COVID Information Using Python

Total active cases in world: 5440736
Total recovered cases in world: 7607033
Total deaths in world: 584990
id : 18
country : US
confirmed : 3499771
active : 2329954
deaths : 137420
recovered : 1075882
latitude : 40.0
longitude : -100.0
last_update : 1594906500000

So this was just a simple Python program to track the information related to Covid-19


If you have any doubt then you can comment below or contact us.

If you want the GUI version for this program and show the data graphically, then click here.

Thank you


Watch YouTube Video



Read More:

  • Auto Login with Python
    So today we will learn how to auto login in a tab using Python. So, let’s first see the code, and then we will understand the code through comments. Code Thanks for visiting the site Keep in touch with our site for more amazing material like this Also read:
  • Adding three matrices
    In python, it’s very easy to deal with matrices due to its simple syntax and we create matrices using nested lists in python. We simply create matrices by creating lists inside lists as follows matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] As you can see we created lists inside a list…
  • Simple Music Player Using Python
    Hello friends, do you know that there are many ways to make music players from simple to advanced level. Here, we are presenting you with two very very basic music player in python. One of them is a simple program and the other one is the GUI program. For the simple program, we have used…
  • Changing Screen Size: Tkinter
    Hello guys welcome again to our site where you get amazing source code absolutely free with explanation So, today’s topic is to change the screen size from the screen by itself by taking the arguments for width and height To change the screen size we have set two entry widgets in front of width and…
  • GUI Age Calculator
    Hello friends, today we will make an age calculator using python’s GUI library tkinter so, let’s start. Python offers a very good GUI library i.e. tkinter which is very easy to learn and use. Here, we are creating a GUI application to calculate age using a button. We will ask the user to enter the…

Share:
Avatar of Harry

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you

8 thoughts on “Get COVID Information Using Python

  1. ImportError: cannot import name ‘covid’ from partially initialized module ‘covid’ (most likely due to a circular import) (c:\Users\hrithik\Desktop\LearningPython\covid.py)

  2. even I import covid as (from covid import Covid)
    it says ImportError: cannot import name ‘Covid’ from partially initialized module ‘covid’ (most likely due to a circular import)
    What do I need to do?

Comments are closed.