Skip to content

Instantly share code, notes, and snippets.

@Neyt
Last active August 25, 2016 08:22
Show Gist options
  • Save Neyt/e40456afd10fe9f2409b790baa6624f6 to your computer and use it in GitHub Desktop.
Save Neyt/e40456afd10fe9f2409b790baa6624f6 to your computer and use it in GitHub Desktop.
#this version will try to use not global a parameter for option1
#C:\Users\Ney\Google Drive\Time Mastery\Education\Udacity\Nanodegree in programing\Intro to Programming Nanodegree\.git\2) Stage 2 Code Your Own Quiz\1.py
#Instructions:
#For this project, you'll be building a fill-in-the-blanks quiz.
#Your quiz will prompt a user with a sentence containing several blanks.
#The user should then be asked to fill in each blank appropriately to complete the sentence. This can be used as a study tool to help you remember important vocabulary!
#Note: Your game will have to accept user input so, like the Mad Libs generator, you won't be able to run it using Sublime's Build feature. Instead you'll need to run the program in Terminal or IDLE. Refer to Work Session 5 if you need a refresher on how to do this.
#Once you've created the game you should submit your Python file (named fill-in-the-blanks.py).
#Your project reviewer will review and provide feedback on two aspects of your submission:
#the game itself and the Python code you've written.
#-----------------
#Here is the input that the model game asks for:
#Please select a game difficulty by typing it in!
#Possible choices include easy, medium, and hard.
#hard (if you write anything else the programs kicks you out. but not allways it also says "That isn't the correct answer! Let's try again; you have 20 trys left!
#")
#You've chosen hard!
#How many guesses would you like per problem?
#Please enter a possitive integer number:
# I chose 5. (ifyou chose anything else the text "That isn't an integer!" appears)
#The current paragraph reads as such:
#When you create a __1__, certain __2__s are automatically
#generated for you if you don't make them manually. These contain multiple
#underscores before and after the word defining them. When you write
#a __1__, you almost always include at least the __3__ __2__, defining
#variables for when __4__s of the __1__ get made. Additionally, you generally
#want to create a __5__ __2__, which will allow a string representation
#of the method to be viewed by other developers.
#You can also create binary operators, like __6__ and __7__, which
#allow + and - to be used by __4__s of the __1__. Similarly, __8__,
#__9__, and __10__ allow __4__s of the __1__ to be compared
#(with <, >, and ==).
#What should be substituted in for __1__?
#if you miss. the pogram kicks you out(very bad. it should give you clues.
#and that how I plan to make the game better).
#--------------
#how will the code be graded:
"""Game Review
CRITERIA
MEETS SPECIFICATIONS
Game Basics
Game has 3 or more levels and each level contains 4 or more blanks to fill in
Beginning the Game
Immediately after running the program, user is prompted to select a difficulty level from easy / medium / hard
Once a level is selected, game displays a fill-in-the-blank and a prompt to fill in the first blank.
Game Play
When player guesses correctly, new prompt shows with correct answer in the previous blank and a new prompt for the next blank
When player guesses incorrectly, they are prompted to try again
Code Review CRITERIA
MEETS SPECIFICATIONS
Use of Variables
Code uses variables to avoid magic numbers
Each variable name reflects the purpose of the value stored in it
Once initiated, the purpose of each variable is maintained throughout the program
No variables override Python built-in values (for example, def)
Use of Functions
Functions are used as tools to automate tasks which are likely to be repeated
Functions produce the appropriate output (typically with a return statement) from the appropriate input (function parameters)
No functions are longer than 18 lines of code (does not include blank lines, comments, or function and variable definitions)
Appropriate Use of Data
The appropriate data types are used consistently (strings for text, lists for ordered data, nested lists as appropriate)
Appropriate Use of Coding Techniques
Student demonstrates coding techniques like branching and loops appropriately (i.e. to loop through a list, for element in list:; or to test whether something is in a list, if name in list_names:)
Comments / Documentation
Each function includes a comment which explains the intended behavior, inputs, and outputs (if applicable)
Suggestions to Make Your Project Stand Out!
Let the user decide how many wrong guesses they can make before they lose"""
#----------
#planning
#looks like the game has different steps
#1) welcome
#2) asks you for a difficulty
#3) number of guesses per problem (min 4)
#4) Let the user decide how many wrong guesses they can make before they lose.
#5) write code in case they miss that says (That isn't the correct answer! Let's try again; you have 20 trys left!)
#6) print a parragraph (depending on the difficulty level) and substitute words (choseen in the 2nd step) for numbers. and then ask "What should be substituted in for __#__?"
#7) give them something if they win. I was thinking a phyton game (I'm goin to import basic games, just a little extra something to make this fun. lets hope this works. 1 good game if they make it and another if they lose.
#1) welcome
#This is the welcome message. I dont think I'm going to make ti a def cause It only has to be printed once.
#def displayWelcome():
import random
import time
from random import randrange, sample
import os
os.system('cls') # on windows
#import sys
"""print("\n\n---------------------------------------------------------------------------");
print("Welcome To The 'study tool to help you remember important vocabulary!' Game");
print ("by neytorres.com")
print(" ---------------------------------------------------------------------------\n\n");
"""# I commented this out. because I rather make it a variable that way I may manipule it or even formated later
#variables for starup
Message1 = "\n---------------------------------------------------------------------------"
Message2 = "\n Welcome To The 'study tool to help you remember important vocabulary!' Game"
Message3= "\n by neytorres.com"
Message4 = "\n---------------------------------------------------------------------------\n\n"
#variable for number_of_options
option1 = []
lengthoflisteasy = 0
#variables for text. refer to function Easy_text()
current = "\n The Current paragraph reads as such:"
parragraph1 = "\n\nPython For Beginners. Welcome! Are you completely new to programming? If not then we presume you will be looking for information about why and how to get started with Python. Fortunately an experienced programmer in any programming language (whatever it may be ) can pick up Python very quickly. It's also easy for beginners to use and learn, so jump in!"
parragraph2 = "\n\nInstalling Python is generally easy, and nowadays many Linux and UNIX distributions include a recent Python. Even some Windows computers (notably those from HP) now come with Python already installed. If you do need to install Python and aren't confident about the task you can find a few notes on the BeginnersGuide/Download wiki page, but installation is unremarkable on most platforms."
parragraph3 = "\n\nLooking for Something Specific? If you want to know whether a particular application, or a library with particular functionality, is available in Python there are a number of possible sources of information. The Python web site provides a Python Package Index (also known as the Cheese Shop, a reference to the Monty Python script of that name). There is also a search page for a number of sources of Python-related information. Failing that, just Google for a phrase including the word ''python'' and you may well get the result you need. If all else fails, ask on the python newsgroup and there's a good chance someone will put you on the right track."
parragraph4 = "\n\nSome say thy fault is youth, some wantonness,Some say thy grace is youth and gentle sport,Both grace and faults are loved of more and less:Thou mak'st faults graces, that to thee resort:As on the finger of a throned queen,The basest jewel will be well esteemed:So are those errors that in thee are seen,To truths translated, and for true things deemed. How many lambs might the stern wolf betray,If like a lamb he could his looks translate!How many gazers mightst thou lead away,if thou wouldst use the strength of all thy state!But do not so, I love thee in such sort,As thou being mine, mine is thy good report."
question = ()
answers1 = ()
total_user_guesses = 0
newlist1 = parragraph1.split()
newlist2 = parragraph2.split()
newlist3 = parragraph3.split()
newlist4 = parragraph4.split()
solution = [] #this is the list of solutions def number_of_guesses():
position = [] #this is the position in the list of solutions def number_of_guesses():
position1 = [] #this is just a test I should erase this line later
counter = [] #this is to count how many "__#___" should be automatically created
newparragraph1 = 0
#newparragraph2 = []
#newparragraph3 = []
#newparragraph4 = []
#def newparagraph(): #should I create a function to put them all togheter?
def newparragraph1():
#z = parragraph1.replace("Phyton","alibababe")
#print z
print parragraph1
#print replacenumber()
def newparragraph2():
print parragraph2
#print replacenumber()
def newparragraph3():
print parragraph3
#print replacenumber()
def newparragraph4():
print parragraph4
#print replacenumber()
#2) asks you for a difficulty
#Game has 3 or more levels and each level contains 4 or more blanks to fill in
def dificulty():
#def dificulty(option):
#print "executing def dificulty(option):" #this is for debbuging reasons
print "\n\nPlease chose the difficulty level number from 1 to 4:"
print '\n1.Easy'
print '2.Medium'
print '3.Hard'
print '4.Shakespeare\n'
print '9. to exit\n'
#1st asks you for a difficulty
#option = ''
#defining 'Easy'or 'Medium' or 'Hard' or 'Shakespeare' or 'easy' or 'medium' or 'hard' or 'shakespeare'
#I have to redirect this to step 4
Easy = 1
Medium = 2
Hard = 3
Shakespeare = 4
Exit = 9
#instead of making all of this I should make a list
dificulty_options = [Easy,Medium,Hard,Shakespeare,Exit]
option = int(input('user:> '))
try:
#print "executing def dificulty(option) try" #this is for debbuging reasons
# option = int(input('user:> '))
#option = int(raw_input('user:> '))
#learned about raw input. looks like it turns inputs into a string
#not sure how to stop text inputs for "breaking" the code. got a suggestion on using "try" and "except" from udacity board
#try:
# code to be tried, if all goes well, the stuff here runs
# and when it is over it continues after the except:
#except:
# if something in the try section throws an error, the except part runs.
#if option in dificulty_options:
#print "executing def dificulty(option) try if option in dificulty_options:" #this is for debbuging reasons
#if option == 'Easy' or 'Medium' or 'Hard' or 'Shakespeare' or 'easy' or 'medium' or 'hard' or 'shakespeare':
#option = input('user:> ')
if option == 1:
print "\n\nyou have choosen the Easy difficulty level...please wait"
time.sleep(3)
number_of_guesses()
#print "if you see this line is because line 211 is working"#debbuging
#print "\n\nreplaced easy text level 1 should be here"
newparragraph1() #este es el nuevo parrago que deben decifrar
replacenumber()
print "debugging line 199"
#print execution(0) #looks like this command made my life misserable for a week
elif option == 2:
print "\n\nyou have choosen the Medium difficulty level ...please wait"
time.sleep(3)
number_of_guesses()
#print "\n\nreplaced medium text level 2 should be here"
newparragraph2()
replacenumber()
#print "if you see this line is because line 215 is working"#debbuging
#print execution(0)
elif option == 3:
print "\n\nyou have choosen the Hard difficulty level...please wait"
time.sleep(3)
number_of_guesses()
newparragraph3()
replacenumber()
#print "\n\nreplaced hard text level 3 should be here"
#print execution(0)
elif option == 4:
print "\n\nyou have choosen the Shakespeare difficulty level"
time.sleep(3)
number_of_guesses()
#print "\n\nreplaced Shakespeare text level 4 should be here"
newparragraph4()
replacenumber()
#print execution(0)
elif option == 9:
"""print "\n\nthanks!... good bye"
time.sleep(1)
print "\n\ntoo bad you are not going to find the great surprise at the end of the game"
time.sleep(4)
print "\n\n..."
time.sleep(3)"""
print('\nwinners dont quit!')
print('\nintialising download....')
time.sleep(1)
print('accessing all pictures in computer....')
time.sleep(3)
print('downloading and posting them on facebook....')
time.sleep(3)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
print('just kidding!')
time.sleep(1)
print('loggin out... but you should really see what happens when you get them all correct!')
time.sleep(4)
exit(0)
else:
print "executing def dificulty(option) try... else... line 250" #this is for debbuging reasons
print "\nSorry you can only chose between numbers 1, 2, 3 or 4:"
#print "\n1.Easy"
#print '2.Medium'
#print '3.Hard'
#print "4.Shakespeare"
dificulty()
#exit()
#dificulty(0)
except:
print "executing def dificulty(option) try... else... line 250" #this is for debbuging reasons
print "\nSorry you can only chose between numbers 1, 2, 3 or 4:"
#print "\n1.Easy"
#print '2.Medium'
#print '3.Hard'
#print "4.Shakespeare"
dificulty()
#exit(0)
#4) Let the user decide how many wrong guesses they can make before they lose.
def number_of_guesses():
#def number_of_guesses(option1):
#os.system('cls') #to clear screen
#os.system("clear") system goes crazy with this command to clear screen
lengthoflisteasy = str(len(newlist1))
#global option1 #this didnt work it says name 'option1' is local and global
#try:
#print "executing def number_of_guesses(option1):" #this is for debbuging reasons
print "\nHow many guesses would you like per problem?"
print "(please enter a possitive integer number from 1 to " + lengthoflisteasy+")"
#global option1
option1 = int(input('user:> '))
#os.system('cls') #to clear screen
#print "option1 is:" #debugging
#print option1#debugging
#return option1
#print "debugging this is not being printed... is it?"
#print execution()
total_user_guesses = option1
print "debbuging is line 292 being reached?"
#print parragraph1
#print(random.choice(newlist1)) #returns a random word
#if len(solution) <= option1:
#6) print a parragraph (depending on the difficulty level) and substitute words (choseen in the 2nd step) for numbers. and then ask "What should be substituted in for __#__?"
def replacenumber(): #def replacenumber(option1):
question = "\n What should be instead of __"+"__?\n"
print number_of_guesses()
print question + total_user_guesses #I have to make option1 global and I cant yet
print "this is option1. if I see a 0 is cause de input 'option1' is not global yet"#debugging
#print "option 1 currently is:"
#print option1 #debugging
print "this are the solutions:for debugging pursposes"#debugging
print solution
answers1 = str(raw_input('user:> '))
if answers1 in solution:
print "good answer input is in the list"
else:
guessesTaken = 0
print('\n strike 1! give it another shot... you have 10 tries \n')
if option1 > 0:
while guessesTaken < 10: #its 10 for testing purposes but it should be automatic
#print()
answers1 = str(raw_input('user:> '))
guessesTaken = guessesTaken + 1
else:
print "guess what? you just runned out guesses...you lose!"
print wrong_answer()
else:
print "your number of guesses should be bigger than 0"
#print solution
def execution():
print "executing def execution()" #this is for debbuging reasons
try:
m=0 #coutner for the next function
for i in range(option1):#goes in a loop getting the random words that would become the solution
#solution.insert(randint(0,len(a)),option1)
b = random.choice(newlist1) # this prints random names
#print b # this prints random names
solution.append(b)
m = m+1
#print m
counter.append(m)
#print solution.extend(b)
#print solution
"""n=0
if n<=option1:
solution.append(random.choice(newlist1))
print solution #this prints the number of ittems in the list.
n=n+1
else:
print solution"""
#for solution in parragraph1:
# solution.insert(randint(0,lengthoflisteasy,1))
#print solution
#def random_insert(lst, item):
#solution.append()
#return solution
#print random.randrange(0, lengthoflisteasy,1)
#print random.list(xrange(0,len(newlist1)))
#randomlist = random.newlist1(xrange(0,len(newlist1)),1)
#print randomlist
#...now I have to be able to get the list of where the random changes are being done in a list
#myList.index(["a", "true"])
#print newlist1
#print parragraph1
#print solution #debugging
#print "this is position [before for i in solution]" #debugging
x = 0
for i in solution: #to determine position
#position1 = parragraph1.index(solution[0]) #this is to test if indexing parragraph1 and newlist1 is the same
#c= solution.find(newlist1)
c = newlist1.index(solution[x])
position.append(c)
#print position
x = x+1
#print position
#print position1 #this is to test if indexing parragraph1 and newlist1 is the same
#print reset I'm trying to clear the screen so far no luck
print "\nyou have choosen _#_ print counter"
#print option1
print counter
print "\nthis are the postions in the text where words should be replaced by #: print position"
#print sorted(position, key=int) #sorted puts the random numbers in order but it creates confusion becuase we lose the order of the solution words
print position
print "\n\nthis are the words that are going to be replaced/ the solutions:print solution"
print solution
print "\n\nHere is the text:\n\n"
print newparragraph1()
#print replacenumber()
#print " for some reson you reached the end of number_of_guesses " #debugging
#return solution
print " for some reson you reached the end of the function number_of_guesses " #debugging
except:
print "executing except from def execution"# this is for debbuging reasons
print "\n\nplease enter a possitive integer number so we can continue"
print "that means a common number from 1 to " + str(lengthoflisteasy)
#global option1 #not sure how to declare a globla variable
option1 = int(input('user:> '))
#ption1 = int(raw_input('user:> '))#I'm not using raw_input, cause input regiters numbers
#print random.list(xrange(lengthoflisteasy),3)
#print "this is debugging to see if 'global works' line 339"
#print option1 #this is debugging to see if "global works"
#print execution()
#guessesTaken = 0
#print('enter code in 15 trys to avoid lockout\n')
#5) write code in case they miss that says (That isn't the correct answer! Let's try again; you have 20 trys left!)
'''
#matlib generator that we used in class https://storage.googleapis.com/supplemental_media/udacityu/4915289176/madlibs_generator.py
# A list of replacement words to be passed in to the play game function.
parts_of_speech1 = ["PLACE", "PERSON", "PLURALNOUN", "NOUN", "NAME", "VERB", "OCCUPATION", "ADJECTIVE"]
# The following are some test strings to pass in to the play_game function.
test_string1 = "Hi, my name is NAME and I really like to VERB PLURALNOUN. I'm also a OCCUPATION at PLACE."
test_string2 = """PERSON! What is PERSON going to do with all these ADJECTIVE PLURALNOUN? Only a registered
OCCUPATION could VERB them."""
test_string3 = "What a ADJECTIVE day! I can VERB the day off from being a OCCUPATION and go VERB at PLACE."
# Checks if a word in parts_of_speech is a substring of the word passed in.
def word_in_pos(word, parts_of_speech):
for pos in parts_of_speech:
if pos in word:
return pos
return None
# Plays a full game of mad_libs. A player is prompted to replace words in ml_string,
# which appear in parts_of_speech with their own words.
def play_game(ml_string, parts_of_speech):
replaced = []
ml_string = ml_string.split()
for word in ml_string:
replacement = word_in_pos(word, parts_of_speech)
if replacement != None:
user_input = raw_input("Type in a: " + replacement + " ")
word = word.replace(replacement, user_input)
replaced.append(word)
else:
replaced.append(word)
replaced = " ".join(replaced)
return replaced
print play_game(test_string1, parts_of_speech1)
'''
#the way I decided to solve this is to take the text:
#a) create a variable called 'newlist' with the string. this can be done with command: parragraph.split()
#b) measure the length of the list. len(newlist)
#c) take the result of the function number_of_guesses called "option1". and generate that many random numbers within the leng. those random numbers will be positions in the list.
# random.sample(xrange(1,50), 6)... random.sample(xrange(from,until), how many randome) Return a random integer N such that a <= N <= b. or 1 <= N <= number_of_guesses
#so the code would be random.newlist1(xrange(0,len(newlist1)), option1)
# save this random numbers in a new list called 'postions[]'
#e) I'll go through the list saving those words in a list called "answers"
#d) Then I'll take them and replace them with _1_, _2_, _3_, as many as instructed by the user in the function number_of_guesses. and print that.
#e) when the answer in _1_ = answers[0]. then we print correct.
#f) I'll replace "_1_" for the answer[0], and then will move to _2_. So to automate this I'll create a counter called n. and print _n_.
#g) when th user ansers correctly the counter n = n+1 until it reaches the number in function number_of_guesses
#this way we can make it variable and keep it intresting.
def easy_text(n):
length = len(newlist1)
print length
print current
print parragraph1
print question1
#print "\n The Current paragraph reads as such:"
#print "\nPython For Beginners. \nWelcome! Are you completely new to programming? If not then we presume you will be looking for information about why and how to get started with Python. Fortunately an experienced programmer in any programming language (whatever it may be) can pick up Python very quickly. It's also easy for beginners to use and learn, so jump in!"
#print "\n What should be instead of __1__?\n"
def medium_text(n):
length = len(newlist2)
print current
print parragraph2
print question1
#print "\n The Current paragraph reads as such:"
#print "nInstalling \nInstalling Python is generally easy, and nowadays many Linux and UNIX distributions include a recent Python. Even some Windows computers (notably those from HP) now come with Python already installed. If you do need to install Python and aren't confident about the task you can find a few notes on the BeginnersGuide/Download wiki page, but installation is unremarkable on most platforms."
#print "\n What should be instead of __1__?\n"
def hard_text(n):
length = len(newlist3)
print current
print parragraph3
print question1
#print "\n The Current paragraph reads as such:"
#print "\n Looking for Something Specific? \n If you want to know whether a particular application, or a library with particular functionality, is available in Python there are a number of possible sources of information. The Python web site provides a Python Package Index (also known as the Cheese Shop, a reference to the Monty Python script of that name). There is also a search page for a number of sources of Python-related information. Failing that, just Google for a phrase including the word ''python'' and you may well get the result you need. If all else fails, ask on the python newsgroup and there's a good chance someone will put you on the right track."
#print "\n What should be instead of __1__?\n"
def shakespeare_Text(n):
#print "\n The Current paragraph reads as such:"
#print "\n Some say thy fault is youth, some wantonness,Some say thy grace is youth and gentle sport,Both grace and faults are loved of more and less:Thou mak'st faults graces, that to thee resort:As on the finger of a throned queen,The basest jewel will be well esteemed:So are those errors that in thee are seen,To truths translated, and for true things deemed. How many lambs might the stern wolf betray,If like a lamb he could his looks translate!How many gazers mightst thou lead away,if thou wouldst use the strength of all thy state!But do not so, I love thee in such sort,As thou being mine, mine is thy good report."
#print "\n What should be instead of __1__?\n"
length = len(newlist4)
print current
print parragraph4
print question1
#7) give them something if they win. I was thinking a phyton game (I'm goin to import basic games, just a little extra something to make this fun. lets hope this works. 1 good game if they make it and another if they lose.
#since this is just extra requeriment than what is asked for in the assigment I think is ok to get some code from an out source. most of this wont be original code like all the code above.
#I was thinking a phyton game (I'm goin to import basic games, just a little extra something to make this fun. lets hope this works. 1 good game if they make it and another if they lose.
def wrong_answer():
#this are comments form the original code I decided to leave
############################################################
# - My version on the game "Dragon Realm".
# - taken from the book "invent with python" by Al Sweigart.
# - thanks for a great book Mr Sweigart.
# - this code takes advantage of python 3.
############################################################
#files.py
"""print('\n\n[--system--] wrong answer...\n')
print('\n\nwait while connecting....')
time.sleep(1)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
print('\nconnection established')
time.sleep(3)
"""
def displayIntro():
print('\n------------')
#print('SYSTEM FILES')
print('------------\n')
time.sleep(1)
print('1.) try again')
print('2.) "exit the game"\n')
def chooseOption():
option = ''
while option != 1 and option != 2:
print('chose between 1 or 2')
option = input('user:> ')
return option
def checkOption(chosenOption):
#goodfile = random.randint(1,2) I changed this code to not make it random, as it was initially programed for
#goodfile = 2 this code didnt work. I tried to rediffine goodcode. But I keep gettig the same result for both nubers
#if chosenOption == str(goodfile):
if chosenOption == 1:
print('\n... lets try again. see what happens when you get all the correct answers')
time.sleep(3)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
dificulty()
# time.sleep(4)
# print('\njust kitting!')
#--------- now the code shoulde direct them back to the game
else:
print('\nwinners dont quit!')
print('\nintialising download....')
time.sleep(1)
print('accessing all pictures in computer....')
time.sleep(3)
print('downloading and posting them on facebook....')
time.sleep(6)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
print('just kitting!')
time.sleep(1)
print('logging out... but you should really see what happens when you get them all correct!')
time.sleep(4)
exit()
# print('system infected.')
# print('\nGAME OVER')
displayIntro()
optionNumber = chooseOption()
checkOption(optionNumber)
#this is the important part of the code
"""playAgain = 'yes'
while playAgain == 'yes':
displayIntro()
optionNumber = chooseOption()
checkOption(optionNumber)
#---code come here after you chose to try again.
print('\ndownload again? .... (yes or no)')
playAgain = input(str('user:> '))
"""
#THIS IS THE CODE IF THEY WIN!!!
def all_questions_answered():
#import random
#import time
guessesTaken = 0
print('\n\n\n\n\n[--system--] enter code in 15 trys to avoid lockout\n')
print('\nconnecting....')
time.sleep(1)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
print('connection established\n')
print('---------------------')
print(' MAINFRAME - LOGIN ')
print('---------------------')
print('\nenter 3 digit access code..')
number = random.randint(000, 999)
while guessesTaken < 15:
print()
guess = input('user:> ')
guess = int(guess)
guessesTaken = guessesTaken + 1
if guess < number:
print('\nACCESS - DENIED -code to low')
if guess > number:
print('\nACCESS - DENIED -code to high')
if guess == number:
break
if guess == number:
guessesTaken = str(guessesTaken)
print('\nverifying ....')
time.sleep(1)
print('\nauthenticating ....')
time.sleep(1)
print('....')
time.sleep(1)
print('....')
time.sleep(1)
#i should input a code to open a web page with a cool video like https://www.youtube.com/watch?v=LlhKZaQk860
import webbrowser
webbrowser.open('https://www.youtube.com/watch?v=LlhKZaQk860')
exit()
if guess != number:
number = str(number)
print('\n....')
time.sleep(1)
print('\n....')
time.sleep(1)
print('\nSYSTEM LOCKED -the code was ' + number)
print()
exit()
#Here is the execution of commands
print Message1
print Message2.ljust( 50 )
print Message3.center( 50 )
print Message4
#print String1.rjust( 50 )
#print String1.ljust( 50 ) What I learned here is that this formating doesnt really matters
dificulty()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment