Technologische_Grundlagen/course/python/02-logic-operator.ipynb

178 lines
3.0 KiB
Plaintext
Raw Permalink Normal View History

2024-09-27 07:00:19 +00:00
{
"cells": [
{
"cell_type": "markdown",
"id": "fd3ba99f-b630-408c-b8f4-e62e189c6057",
"metadata": {},
"source": [
"### Python Logic Operators"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "58b1616e-9df5-426c-857b-d3017f052b07",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"False\n"
]
}
],
"source": [
"print(1 == 2)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c87c73b4-414c-49b2-9e8f-fb3ea64f734a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(1 != 2)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "c0785e94-8795-4200-8148-50eea688e381",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"False\n"
]
}
],
"source": [
"print(1>2)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "51a3869d-14f4-4f36-89a5-8b274e6867bb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"False\n"
]
}
],
"source": [
"print(\"1\" == 1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d77b7f00-7eaf-4812-a2b9-57dc00dfc701",
"metadata": {},
"outputs": [],
"source": [
"### Add multiple condition"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "0c4650aa-71f5-43e1-a027-fd68db0c585e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(1 < 10 and 1 > 0)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "97b73046-93fc-4496-bbcc-e4cd83b9e971",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(1 < 10 or 1 > 10)\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "69781d14-9295-42cd-935a-eef3e4e6c1e6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"print(not \"bla\" == \"blup\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e2e24ad8-fec6-4399-aada-f09f6f35b992",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"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.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}