Created
August 23, 2016 15:06
-
-
Save CrazyPython/c6b63876ac66596973f2c494d7c20d93 to your computer and use it in GitHub Desktop.
valid code - for showing non-programmers the world of programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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