Skip to content

Instantly share code, notes, and snippets.

@MrDMurray
Created September 21, 2016 23:04
Show Gist options
  • Save MrDMurray/ae9e6db1df985703b2e625293c67e8a2 to your computer and use it in GitHub Desktop.
Save MrDMurray/ae9e6db1df985703b2e625293c67e8a2 to your computer and use it in GitHub Desktop.
STJLOL-DMU- If AND else OR Boolean logic
#-------------------------------------------------------
#The Mr. Murray Detector 9000
#-------------------------------------------------------
#The program asks the user 3 yes or no questions
beard=input("Does this person have a beard? yes or no?")
shirt=input("Does this person wear a shirt? yes or no?")
science=input("Is he talking about science? yes or no?")
#only gives the Mr. Murray answer if all three are equal to yes.
if beard=="yes" and shirt=="yes" and science=="yes":
print("You're probably talking to Mr. Murray")
else:
print("That's probably someone else.")
#-------------------------------------------------------
#Beatle member identifier
#-------------------------------------------------------
beatle=input("Name a beatle")
if beatle == "John" or beatle == "Paul" or beatle == "George":
print("Correct. They are indeed.")
elif beatle == "Ringo":
print("Yeah I suppose Ringo Star still counts")
#-------------------------------------------------------
#The PasserFailer
#-------------------------------------------------------
score = "20"
if score >= "40": #if you get 40 or more...
print("Well done, you got over 40% and passed")
if score <= "39": #if you get 39 or less...
print("Sorry but you didn't pass this time")
#-------------------------------------------------------
#The password blocker
#-------------------------------------------------------
password=input("Please enter the secret password to use my program")
# the user types in a password
if password != "ROFLCOPTER":
print("Na ah aahh! You didn't say the magic word!")
# if the password is not ROFLCOPTER, they shall not pass!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment