{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Print the number of hours in 4 weeks, using as many variables as useful (at least 5 variables)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "a and x are int variables. Suppose that they already contain a value. Does this cell leave the value of x identical to what is was before the execution of the cell? Write a thorough comment making me understand that you have understood."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a=x\n",
    "a=a+1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "a and x are int variables. Suppose that they already contain a value. Does this cell leave the value of x identical to what is was before the execution of the cell? Write a thorough comment making me understand that you have understood."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "x=x+1\n",
    "x=x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "a and x are int variables. Suppose that they already contain a value. Does this cell leave the value of x identical to what is was before the execution of the cell? Write a thorough comment making me understand that you have understood."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a=x\n",
    "x=a+1\n",
    "x=a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "a and x are int variables. Suppose that they already contain a value. Does this cell leave the value of x identical to what is was before the execution of the cell? Write a thorough comment making me understand that you have understood."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "x=a+1\n",
    "x=x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "a and x are int variables. Suppose that they already contain a value. Does this cell leave the value of x identical to what is was before the execution of the cell? Write a thorough comment making me understand that you have understood."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "z=x\n",
    "a=z\n",
    "x=a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Assign the value of 100 to the variable <b>m</b> and \"days\" to <b>s</b>.\n",
    "With the help of the two variables, write one single line of code where the output after execution would be 100 days.\n",
    "\n",
    "Provide two answers using two different print methods."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Extract the letter 'B' from \"Bingo!\"."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Extract the letter \"u\" from \"Constitution\"."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Given any string <b>s</b> (which can also be empty), which of the following expressions gives the same value as the original value of <b>s</b> regardless of the initial value of <b>s</b>? Write a comment on each one making me understand that you have understood.\n",
    "- ('a'+s)[1:]\n",
    "- s+\"\"\n",
    "- s[0]+s[1:]\n",
    "- s[0:]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Given two string variables containing your first name and your last name, write Python code that prints out a single word which is a  concatenation of the first two letters of your first name and the last two letters of your last name."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Assume A is a string variable. Write Python code that prints the position of the second occurrence of _zip_ in A, together with the previous character. For example, for A=\"the zip-files are unzipped\" it should print 20 and \"n\", while for A=\"zip files are compressed\" it should print -1 (do not worry about what it prints next in this case).\n",
    "<p><font color=BLUE>I think it is obvious that the program must work for <b>any</b> string A, simply changing the string at it beginning, without having to manually change numbers inside. If you are able to write a program with numbers manually written inside, try to find a way to get those numbers automatically.</font> \n",
    "<p><font color=PURPLE>Strategy: after having thought at the problem, if you can't come up with a working algorithm click below to reveal it. I said <b>after having thought</b>\n",
    "<details>Your task is to find the <b>second</b> occurrence. You already have a tool to find the <b>first</b> occurrence and you have therefore a method to know where the index of the first occurence is. You have also a tool to find an occurrence after a certain index. Combining the two things gives you the solution. For the other part, once you know the second occurrence's index you can easily get the character in the previous position. \n",
    "<br>I remind you that, even though we have always printed the result of the find method, you can also put it inside a variable or use it as argument for other find methods.\n",
    "    </details>\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Assume A is a float variable containing a float number with several digits after the dot. Build a Python code which prints A rounded down to two decimal digits. For example, if A were 67.34563 the program should print 67.34. Do not use any _round_ or _floor_ or _int_ function.\n",
    "<p><font color=RED>For this exercise do NOT use the round function, it would be too easy!\n",
    "<p><font color=BLUE>I think also it is obvious that the program must work for <b>any</b> number with a dot, regardless the amount of digits before and after the dot. \n",
    "<p><font color=PURPLE>Strategy: after having thought at the problem, if you can't come up with a working algorithm click below to reveal it. I said <b>after having thought</b>\n",
    "    <details>Strategy: Once this number is a string, you know a tool to find the index of the decimal dot and you can use it to cut appropriately the string while printing it. </details>\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create a variable with name <b>y</b> with a float (non integer) value. Display it. Then display its corresponding rounded down value. NOte that this must work for any y number."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Turn 99 into a *float*."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Turn 0.99 into an integer. Comment the value that you get"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "...."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Notable Built-In Functions in Python"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Obtain the maximum number among the values 25, 65, 890, and 15."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Round 35.56789 to the third decimal digit using an appropriate function."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Use a built-in function to raise 10 to the power of 3."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "How many characters are there in this paragraph? (beware of apostrophes and double quotation)\n",
    "\n",
    "O Romeo, Romeo, wherefore art thou Romeo? Deny thy father and refuse thy name. Or if thou wilt not, be but sworn my love and I'll no longer be a Capulet. 'Tis but thy name that is my enemy: thou art thyself, though not a Montague. What's \"Montague\"? It is nor hand nor foot nor arm nor face nor any other part belonging to a man."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "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.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
