Skip to content

Instantly share code, notes, and snippets.

@CrazyPython
Created August 23, 2016 15:06
Show Gist options
  • Save CrazyPython/c6b63876ac66596973f2c494d7c20d93 to your computer and use it in GitHub Desktop.
Save CrazyPython/c6b63876ac66596973f2c494d7c20d93 to your computer and use it in GitHub Desktop.
valid code - for showing non-programmers the world of programming
# This is a comment. The computer will ignores all comments.
# They are basically notes you put in code just to remind you (the human!)
# what the code does next time you read over it so we coders don't forget.
# In Python, anything after a "#" is considered a comment.
# We'll use comments to talk about the code that will be shown.
# And by the way, the computer ignores blank lines
wearing_pants = False # this is a variable assignment.
# `wearing_pants` could've been any name,
# but we usually choose a descriptive name
# so we can remember what the variable actually
# stores. The computer doesn't really care about
# names as long as it's not been taken or invalid*.
if not wearing_pants: # the not operator, will turn True to False and False to True.
print("Why aren't you wearing pants!?!") # print writes text output to the console. It just outputs stuff, okay?
else: # else specifies what do if the condition isn't true
print("Good, you're wearing pants. You get a promotion!")
# Part Two is coming soon.
# *for example, this code is equivalent:
fgjfkg = True
if not fgjfkg:
print("Why aren't you wearing pants!?!")
# but who's crazy enough to do that?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment