Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Python programming
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerald W. Höfner
Python programming
Commits
e90f9b4a
Commit
e90f9b4a
authored
2 years ago
by
Franziska Niemeyer
Browse files
Options
Downloads
Patches
Plain Diff
Upload solutions for gap_exercise3_if_else
parent
69751311
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Exercises/solutions/gap_exercise3_if_else.ipynb
+211
-0
211 additions, 0 deletions
Exercises/solutions/gap_exercise3_if_else.ipynb
with
211 additions
and
0 deletions
Exercises/solutions/gap_exercise3_if_else.ipynb
0 → 100644
+
211
−
0
View file @
e90f9b4a
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "gap_exercise3_if_else.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"source": [
"# Python course - Exercises Gap text"
],
"metadata": {
"id": "kH0p2uT-sQ6y",
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "markdown",
"source": [
"Correct the Code"
],
"metadata": {
"id": "uW9SoYEyrlRL",
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "code",
"source": [
"# complete the statement for b larger than a\n",
"a = 5\n",
"b = 10\n",
"\n",
"if b > a:\n",
" print('b larger a')"
],
"metadata": {
"id": "uoscfCSCK980",
"pycharm": {
"name": "#%%\n"
},
"outputId": "9b383eb8-a957-4975-9ece-bdebb1bbf55e",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"b larger a\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# complete the statements\n",
"a = 5\n",
"b = 10\n",
"c = 5\n",
"\n",
"if(a < b) and (a == c):\n",
" print('a smaller b, but a equals c')"
],
"metadata": {
"id": "9DGKzqxWdABE",
"pycharm": {
"name": "#%%\n"
},
"outputId": "eeb99a8a-426d-4a9f-fc6a-bf035e67b31d",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"a smaller b, but a equals c\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# complete the statements\n",
"a = 5\n",
"b = 10\n",
"c = 5\n",
"\n",
"if a <= c:\n",
" print('a smaller or equal c')\n",
"elif a >= b:\n",
" print('a larger or equal b')"
],
"metadata": {
"id": "3ipcaNRCdv9S",
"pycharm": {
"name": "#%%\n"
},
"outputId": "96acdcd0-91e1-443b-b6de-7f6a95239a91",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"a smaller or equal c\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# complete the statements\n",
"a = 5\n",
"b = 10\n",
"c = 5\n",
"\n",
"if a != c:\n",
" print('a not c')\n",
"elif a == b:\n",
" print('a equals b')\n",
"else:\n",
" print('None of the above is true')"
],
"metadata": {
"id": "w9QBlM8Hel_u",
"pycharm": {
"name": "#%%\n"
},
"outputId": "5c9c3e63-7ec3-417d-c08d-f9f8ee6f9b92",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"None of the above is true\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"# complete the statements\n",
"a = 5\n",
"b = 10\n",
"c = 5\n",
"\n",
"if (a != c) or (b != c):\n",
" print('a not c OR b not c')\n",
"else:\n",
" print('None of the above is true')"
],
"metadata": {
"id": "5KfDsRHLfW7k",
"pycharm": {
"name": "#%%\n"
},
"outputId": "7d073833-18cf-4de7-9814-f3d422642b4b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"a not c OR b not c\n"
]
}
]
}
]
}
\ No newline at end of file
%% Cell type:markdown id: tags:
# Python course - Exercises Gap text
%% Cell type:markdown id: tags:
Correct the Code
%% Cell type:code id: tags:
```
# complete the statement for b larger than a
a = 5
b = 10
if b > a:
print('b larger a')
```
%% Output
b larger a
%% Cell type:code id: tags:
```
# complete the statements
a = 5
b = 10
c = 5
if(a < b) and (a == c):
print('a smaller b, but a equals c')
```
%% Output
a smaller b, but a equals c
%% Cell type:code id: tags:
```
# complete the statements
a = 5
b = 10
c = 5
if a <= c:
print('a smaller or equal c')
elif a >= b:
print('a larger or equal b')
```
%% Output
a smaller or equal c
%% Cell type:code id: tags:
```
# complete the statements
a = 5
b = 10
c = 5
if a != c:
print('a not c')
elif a == b:
print('a equals b')
else:
print('None of the above is true')
```
%% Output
None of the above is true
%% Cell type:code id: tags:
```
# complete the statements
a = 5
b = 10
c = 5
if (a != c) or (b != c):
print('a not c OR b not c')
else:
print('None of the above is true')
```
%% Output
a not c OR b not c
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment