{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "deletable": false, "editable": false, "id": "UHboGMaN-lUP", "nbgrader": { "checksum": "bb49bf176e542a22a73c154e2658d6ea", "grade": false, "grade_id": "cell-be04006a1edf3189", "locked": true, "schema_version": 1, "solution": false } }, "source": [ "# SSS1 | Python Basics" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "fAEzJgrrN9u9" }, "source": [ "\n", "
Name | \n", "Type | \n", "Description | \n", "
---|---|---|
integers | \n", "int | \n", "whole numbers, such as: 1, 20, 50 | \n", "
floating point | \n", "float | \n", "decimal point numbers: 5.1, 100.0, 9.8 | \n", "
strings | \n", "str | \n", "ordered sequence of characters: \"hello\", \"10\" | \n", "
lists | \n", "list | \n", "ordered sequence of objects: [\"hello\", \"10\", 200.25] | \n", "
dictionaries | \n", "dict | \n", "unordered (key:value) pairs: {'key1': value, 'name': 'peter'} | \n", "
booleans | \n", "bool | \n", "logical value: True or False | \n", "
tuples | \n", "tuple | \n", "ordered sequence of objects (immutable): ('name', 20, 40.6) | \n", "
\n", " Key Takeaways from Todayยดs SSS\n", "We love snakes, especially pythons! ๐๐๐\n", " Python can replace your calculator. Use: + for addition, - for subtraction, * for multiplying, / for dividing, // for dividing without decimal places, % for reminder after division. \n", " Python's math operators follow some order of precedence.\n", " Python stores data in diffrent datatypes: Integers, Strings, Booleans, Lists, Tuples, Sets...\n", " String is a sequence of characters inside quotes(\" \" or ' ' or ''' ''' for multiline string)\n", " EDIT THIS CELL TO ADD YOUR TAKEAWAY!:)\n", " We use print() to display variable or result of function to user.\n", "" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "_hCT3HhhAhhF" }, "source": [ "## Are you ready to submit your notebook?\n", "This part contains code that checks if your submission is corrected and ready to be graded by your peer tutors. Feel free to run the cell and check if everything is done. Peer tutors will run even more tests to check if your submissions are correct, but it will be very similar to this one. Remember, It is OK to submit an unfinished notebook if you worked hard during the SSS, but try to finish it in your free time or visit your peer tutor's Office Hours to get more up-to-speed and gain confidence in coding." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": {}, "colab_type": "code", "id": "At0lJe0yNg1V" }, "outputs": [], "source": [ "# PLEASE DO NOT EDIT THIS CELL\n", "\n", "# Pre-Lab Activity\n", "print (\"Testing Pre-Lab Acitivity...\")\n", "try:\n", " if (tutor_name != \"write the name here\" and tutor_country != \"\" and tutor_shoe_size > 0 and tutor_OH_time != \"\"):\n", " print(\"--->Peer Tutor Knowledge: Excelent!\")\n", " else:\n", " print(\"--->Peer Tutor Knowledge: Are your sure that you know your peer tutor?\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "try:\n", " if(makeup_work_needed_if_absent and undocumented_absences_allowed == 2 and min_late_time == 5 and max_late_time_allowed == 15):\n", " print(\"--->SSS Rules Knowledge: Very impressive!\")\n", " else:\n", " print(\"--->SSS Rules Knowledge: Please, ask your peer tutor for more details about the rules.\")\n", "\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", " # LAB Part\n", "print(\"Testing Lab Part\")\n", "try:\n", " if (my_large_num < 2**10000):\n", " print(\"--->Python as Calculator: Good job!\")\n", " else:\n", " print(\"--->Python as Calculator: Your Number could be even bigger!\")\n", "\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "try:\n", " if (not my_decision):\n", " print(\"--->Booleans: Good job!\")\n", " else:\n", " print(\"--->Booleans: You should look one more time\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "try:\n", " if (type(add_three) == function):\n", " print(\"--->Functions: Wonderful\")\n", " else:\n", " print(\"--->Functions: Please check the syntax of your function\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "# Exercises part\n", "print(\"Testing Exercises Part...\")\n", "try:\n", " if (seconds > 60*60*24*(20+31+30+31)):\n", " print(\"--->Exercise 1.1: Good Estimation\")\n", " else:\n", " print(\"--->Exercise 1.1: Your number is smaller then number of seconds in this semester, do not forget about the second semester!\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "try:\n", " if (temp_fahrenheit == ((temp_celsius * 1.8) +32)):\n", " print(\"--->Exercise 1.2: Good Conversion\")\n", " else:\n", " print(\"--->Exercise 1.2: Check your formula again!\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "try:\n", " if (distance_kilometers* 1.7 > distance_miles > distance_kilometers* 1.5):\n", " print(\"--->Exercise 1.3: Wonderful job again!\")\n", " else:\n", " print(\"--->Exercise 1.3: Check your formula one more time, maybe there is bug nearby.\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "\n", "try:\n", " if ((statement1 == False) and (statement2 == True) and (statement3 == True) and (statement4 == False)):\n", " print(\"--->Exercise 2: Good work with logic statements. In python, logic is easy, isn't it?\")\n", " else:\n", " print(\"--->Exercise 2: Please, check your logical expressions\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "\n", "try:\n", " if (my_function(0) == 3) and (my_function(100) == 303):\n", " print(\"--->Exercise 3: I like your my_function()\")\n", " else:\n", " print(\"--->Exercise 3: I double checked my calculation, but it do match with you function my_function\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")\n", "\n", "\n", "try:\n", " if (linear_function(5,10,2) == 52) and (linear_function(-1,5,7) == 2):\n", " print(\"--->Exercise 3.1: Nice linear function\")\n", " else:\n", " print(\"--->Exercise 3.1: Is your function really linear?\")\n", "except:\n", " print(\"ERROR: Have you run all cells without errors?\")" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "4QYxR-sONg1X" }, "source": [ "### Thank you, now you are ready to submit!\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import miupload\n", "miupload.login_gui() # Please enter your Minerva email and activation code from email." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "miupload.submit_notebook(assignment = \"SSS1\")" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "qRedHX1GG4Hg" }, "source": [ "\n", "