Skip to content

Instantly share code, notes, and snippets.

@iulian-lucaci
Created September 15, 2019 11:07
Show Gist options
  • Save iulian-lucaci/70b8cce5c7746601d7ee15b4913ce967 to your computer and use it in GitHub Desktop.
Save iulian-lucaci/70b8cce5c7746601d7ee15b4913ce967 to your computer and use it in GitHub Desktop.
Created on Cognitive Class Labs
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3 align=center>Hello World</h3>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's say Hello to the world with a <code>PRINT</code> statement. E.g. <code>print(\"Hello World\")</code>. Why not give it a try put in a print statement in the cell bellow. Don't forget to do <kbd>shift</kdb>+<kbd>enter</kbd> to run the cell:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello\n",
"World!\n"
]
}
],
"source": [
"print(\"Hello\\nWorld!\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3 align=center>Say Hello World on two lines</h3> "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's print Hello and World on two separate lines. Hint: \\n in the middle of the string acts as a new line character. E.g. <code>print(\"line 1\\nline 2\")</code>. Let's try it now. Type in a print statement in the cell bellow. Don't forget to do <kbd>shift</kdb>+<kbd>enter</kbd> to run the cell:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# print('Hello World!')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3 align=center>Comments are key to good coding</h3> "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In python, comments are created by putting a hash mark <code>#</code> in front of the text of the comment. E.g. <code># this is a comment</code>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<hr>\n",
"<small>Copyright &copy; 2018 IBM Cognitive Class. This notebook and its source code are released under the terms of the [MIT License](https://cognitiveclass.ai/mit-license/).</small>"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python",
"language": "python",
"name": "conda-env-python-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment