Newer
Older
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Python_course_2021_exercises_B.ipynb","provenance":[],"collapsed_sections":[],"authorship_tag":"ABX9TyOECfEbqoA1+SPfgVXeDINI"},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"markdown","metadata":{"id":"9vv0rpCuGI-0"},"source":["# Python course 2021 - Exercises B\n","\n"]},{"cell_type":"markdown","metadata":{"id":"MmKoM-5LGKuq"},"source":["## Part1 - control structures"]},{"cell_type":"markdown","metadata":{"id":"G7FusG7CGbta"},"source":["\n","\n","---\n","1.1) Write a script for guessing numbers!\n"]},{"cell_type":"code","metadata":{"id":"scIcmdvJGjAe","executionInfo":{"status":"ok","timestamp":1647801946865,"user_tz":420,"elapsed":4,"user":{"displayName":"Katharina Sielemann","photoUrl":"https://lh3.googleusercontent.com/a/default-user=s64","userId":"00960067943696917992"}}},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"0q2YJKgCGjTT"},"source":["\n","\n","---\n","1.2) Add tips (smaller/larger) during the guessing process!\n"]},{"cell_type":"code","metadata":{"id":"MATuLFxCGryV"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"69vKvpfXG1O0"},"source":["## Part2 - loops"]},{"cell_type":"markdown","metadata":{"id":"WmbSBvCGG6Fc"},"source":["\n","\n","---\n","2.1) Write a function counting to 100 and printing all numbers which can be divided by 4 without any residue!\n","\n","* Info: 10%2 #modulo division in Python\n"]},{"cell_type":"code","metadata":{"id":"N7JQLOS4HYIc"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"G3ocU6nnHYTp"},"source":["\n","\n","---\n","2.2) Write a function counting down from 1000 to 0 and printing all numbers!\n"]},{"cell_type":"code","metadata":{"id":"Zr_WTneeHgo4"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"F_k9KW4gHgwg"},"source":["\n","\n","---\n","2.3) Generate a list of species names! Write a function printing all species names starting with \"E\"!\n"]},{"cell_type":"code","metadata":{"id":"daVLjj-aHo_C"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"vC_BZDXZHpJA"},"source":["\n","\n","---\n","2.4) Expand this function to limit the printing to species names which are additionally shorter than 10 characters!\n"]},{"cell_type":"code","metadata":{"id":"BS1PycUwHydi"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"C0aWx374HykI"},"source":["\n","\n","---\n","2.5) Expand this function to limit the printing to species names which are additionally ending with \"a\".\n"]},{"cell_type":"code","metadata":{"id":"2dO2405CH8Ab"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"SL5Jk3GHIMLx"},"source":["## Part3 - range & enumerate"]},{"cell_type":"markdown","metadata":{"id":"A65Z5AeQIQrQ"},"source":["\n","\n","---\n","3.1) Write a script to print 50x \"here\" and the current value of the control variable!\n"]},{"cell_type":"code","metadata":{"id":"kwRdBZ5lIaWb"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"EXYM3E55Iaf4"},"source":["\n","\n","---\n","3.2) Write a script to walk through the species list and to print the character from the species where the index corresponds to the current control variable value!\n"]},{"cell_type":"code","metadata":{"id":"xf1tPln-Im6w"},"source":[""],"execution_count":null,"outputs":[]}]}