Skip to content

Instantly share code, notes, and snippets.

@iamukasa
Created June 28, 2017 21:18
Show Gist options
  • Save iamukasa/16ac728cdc01fabaf8d6cc13f67661a6 to your computer and use it in GitHub Desktop.
Save iamukasa/16ac728cdc01fabaf8d6cc13f67661a6 to your computer and use it in GitHub Desktop.
Program to solve the problem set: A monkey is randomly hitting keys in a keyboard,how long does it take it to type a word
import sys,random,time
alpha=('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','s','t','u','v','w','x','y','z')
words=""
starttime =time.time()
#monkey iterator
while str(sys.argv[1]) not in words :
a=random.choice(alpha)
words+=a
print words
endtime =time.time()
print 'The monkey took',endtime- starttime,'seconds'
@MwirabuaTimothy
Copy link

A US President is randomly hitting keys to type a tweet. How long does he take to type covfefe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment