LO: Be able to print output
Run the cell below to print your very first python output!
print('Hello World!')
We can also assign our message to a variable named 'message' and print that!
message = 'Hello World!'
print(message)
Congratulations! You've just printed your first output in Python. Now, it may be a bit of an assumption to assume there is only one world out there.
Below, change the message to 'Hello Worlds?' and print it.
# YOUR CODE HERE
raise NotImplementedError()
### BEGIN TESTS
assert message == 'Hello Worlds?'
### END TESTS
Comments are a helpful way to explain your code to others and your future self. Take a look at the examples below. Run the cells.
# This is a comment. It helps explain the context of your code and why you made certain decisions
# You can have many lines of comments in a row
my_var = 2 # You can also create 'in-line' comments to explain specific lines
Note that output is not generated for these lines.
'''
This is another type of comment, generally used for creating docstrings.
These help breakdown complex functions, objects, classes and others.
They can also be referenced as help documentation for functions and modules you
create.
'''
Modify the comments in the function below to make them more helpful. If you're not sure, don't worry, we'll learn more about what's happening in this function later.
def add_num(a,b):
'''
What does this function do?
What are the inputs and outputs?
'''
total = a + b # what is this line doing?
# what am I doing next?
print(total)
You will learn functions later, but notice that our docstring gets saved when we define a function. We can access this later.
print(add_num.__doc__)