Creating a Digital Clock using Python
A digital clock is a clock which displays the time digitally in the form of numerals and other symbol’s, these can be very useful and effective, when it remains on screen and to those who don’t understand analog clocks properly. Nowadays, Digital clocks are been used in every place as it is accessible anywhere. But, have you ever wondered how these digital clocks work on devices from a digital watch to televisions or how datetime libraries are used in programming languages such as Python? The whole procedure starts by importing the datatime library present in the python which will allow us to play around with all the datetime functions available. The whole project is built by using datetime fucntion without any Graphical user interface, which will enhance the user ability to think what actually happens inside the code using datetime package, apart from this the user will also gain vast knowledge on how can we use for loops, if-else and break statements in the code effectively.
Code Description & Execution
- The first step in writing program , the required libraries should be imported in our program for creating digital clock the import libraries are time, datetime
- There are two different codes in the notebook the first returns the current date and time
- The second code result will be our digital clock
- To clear the output or to eliminate redundancy we use clear_output
How to Execute?
Download zip from here and extract it .
Step 1 :
You need to open the jupyter notebook in the path directory on the anaconda prompt shell.
In my case
- To perform the above step you already need to have knowledge of installing jupyter notebook and running anaconda shell, if you don’t know how to install or run jupyter notebook check our previous articles about it.
- Step 2:
- Open .ipynb file from the folder
- Run the file
Issues you may face
- 1. While giving right path in the Anaconda prompt shell to open jupyter notebook in correct directory or opening the correct ipynb file.
All the required data has been provided over here. Please feel free to contact me for model weights and if you face any issues.
Yes, you now have more knowledge than yesterday, Keep Going.