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 PythonSo 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 PythonIn 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 PythonHello friends, do you know that there are many ways to make music players from simple to advanced levels? 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 a GUI program. For the simple program, we have used…
- Changing Screen Size: TkinterHello 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 CalculatorHello 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…