Skip to content

Instantly share code, notes, and snippets.

@manuelgeologo
Created July 13, 2020 02:21
Show Gist options
  • Save manuelgeologo/712851c7296df962cdd9bc51150eb807 to your computer and use it in GitHub Desktop.
Save manuelgeologo/712851c7296df962cdd9bc51150eb807 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": "<h3 align=center>Comparison operations</h3> "
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Find the value of <code>i</code> that produces a <code>True</code> "
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": "i=200\ni>100"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<h3 align=center>Branching </h3> "
},
{
"cell_type": "markdown",
"metadata": {},
"source": "Find the value of <code>x</code> that prints the statement: <code>\"this is a\"</code>"
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "this is a\n"
}
],
"source": "x='a'\nif(x=='a'):\n print(\"this is a\")\nelse:\n print(\"this is not a\")"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<h3 align=center>Logic Operators</h3> "
},
{
"cell_type": "markdown",
"metadata": {},
"source": "find the value of <code>y</code> that produces a <code>True</code> statement "
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": "True"
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": "y=1\nx=1\nx>0 and y<10"
},
{
"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>"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": ""
}
],
"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.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment