Skip to content

Instantly share code, notes, and snippets.

@ayota
Created October 19, 2013 16:23
Show Gist options
  • Save ayota/7058040 to your computer and use it in GitHub Desktop.
Save ayota/7058040 to your computer and use it in GitHub Desktop.
def sandwich (Slices, HasPeanutButter, HasJelly):
Bread = Slices/2
HasPeanutButter = HasPeanutButter
HasJelly = HasJelly
if Bread >= 1 & HasPeanutButter == True: #check for enough bread
if Bread >= 2: #assign plural or not plural
Plural = "es"
else:
Plural = ""
if HasJelly == True: #check for jelly
Jelly = " and jelly."
else:
Jelly = "."
print "You can make {0} sandwich{1} with peanut butter{2}".format(Bread,Plural,Jelly)
else:
print "Go to the store."
sandwich(2456, True, True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment