Last active
October 10, 2015 17:28
-
-
Save ehgoodenough/3725579 to your computer and use it in GitHub Desktop.
I've had a bit of difficulty working the equations assigned in digital logic that are designated in base two, so I coded this up to acquaint myself with binary.
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
import random | |
while True: | |
decivalue = random.randrange(0,99) | |
binavalue = bin(decivalue)[2:] | |
answer = int(input("What is " + binavalue + " in base ten? ")) | |
if answer == decivalue: | |
print("..hooray! :D") | |
else: | |
print("..try again.. :<") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment