{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Additional Exercises - Week 1\n",
"## Variables, Input, Output, if-elif-else\n",
"\n",
"If you are eager to practise a little more, here are some exercises.\n",
"\n",
"### Personal data\n",
"Get the personal data (name, firstname, city, ...) of a person using `input()`. Output a statement, which summarizes the input. Example:\n",
"\n",
" What is your name: Jacobs\n",
" What is your firstname: Stephan\n",
" Where do you live: Aachen\n",
" Stephan Jacobs lives in Aachen"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Rectangular cuboid\n",
"A rectangular [cuboid](https://en.wikipedia.org/wiki/Cuboid) is a six-faced geometrical object. All angles are right angles and the edges can have three different lengths *a, b, c*. The Volume of the cuboid can be calculated with the formula:\n",
"\n",
" Vol = a * b * c\n",
" \n",
"The surface of the cuboid can be calculated with the formula:\n",
"\n",
" Sur = 2 * (a * b + a * c + b * c)\n",
" \n",
"Write a program, that asks for the length of `a`, `b` and `c` and outputs the volume and the surface of the cuboid. Example:\n",
"\n",
" What is the length of the first edge: 3\n",
" What is the length of the second edge: 4\n",
" What is the lenght of the third edge: 5\n",
" The cuboid has a volume of 60 and a surface of 94"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Window\n",
"The window should be open if it is warm and if it is not raining. Get the information if it is warm and if it is raining by `input()`. Then output if the window shall be open or closed. Example:\n",
"\n",
" Is it warm? y\n",
" Does it rain? n\n",
" The window should be open.\n",
" \n",
" Is it warm? y\n",
" Does it rain? y\n",
" The window should be closed.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Celsius and Fahrenheit and Kelvin\n",
"There are different scales for temperature. To convert the temperatures there are the following formulas:\n",
"\n",
" Celsius = 5/9 * (Fahrenheit - 32)\n",
" Celsius = Kelvin - 273.15\n",
" \n",
"Write a program, that takes Celsius as input and outputs the values in Fahrenheit and Kelvin.\n",
"\n",
" What is the temperature in Celsius: 25\n",
" 25 Celsius is the same as 77.0 Fahrenheit\n",
" 25 Celsius is the same as 298.15 Kelvin"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Calulate the mean\n",
"Using `input()` get five numbers and calculate the mean of these values. Example:\n",
"\n",
" First number: 10\n",
" Second number: 20\n",
" Third number: 15\n",
" Fourth number: 23\n",
" Fifth number: 18\n",
" The mean is: 17.2\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Sort three numbers\n",
"Write a program, that sorts three numbers. The numbers are taken with `input()`. Example:\n",
"\n",
" First number: 34\n",
" Second number: 12\n",
" Third number: 50\n",
" 50 34 12"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}