Last active
April 4, 2023 16:48
-
-
Save ixxra/8651122 to your computer and use it in GitHub Desktop.
Simple binary/hexadecimal clock written in python for my "introduction to numerical analysis class".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Simple binary/hexadecimal clock written in python. | |
| This programm is an example for my "introduction to numerical analysis class" at Universidad Autonoma de Yucatan. | |
| Feel free to copy/modify at your convenience. | |
| ''' | |
| import time | |
| def decimal_time(): | |
| ''' | |
| Simple function to return a triad | |
| (hour, minute, seconds) | |
| in decimal base. | |
| ''' | |
| t = time.strftime('%H %M %S').split() | |
| return tuple(map(int, t)) | |
| while True: | |
| t = decimal_time() | |
| print '----------------------------' | |
| print '' | |
| print 'Decimal time:' | |
| print '%s : %s : %s' % t | |
| print '' | |
| print 'Binary time:' | |
| print '%s : %s : %s' % tuple(map(bin, t)) | |
| print '' | |
| print 'Hexadecimal time:' | |
| print '%s : %s : %s' % tuple(map(hex, t)) | |
| print '' | |
| time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`
'''
Simple binary/hexadecimal clock written in python.
This programm is an example for my "introduction to numerical analysis class" at Universidad Autonoma de Yucatan.
Feel free to copy/modify at your convenience.
'''
import time
def decimal_time():
'''
Simple function to return a triad
while True:
t = decimal_time()
H=int(t[0])
M=int(t[1])
S=int(t[2])
print ('----------------------------')
print('')
`
I fixed it :)