{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Exercise1:\n#Note: zip tuples and finding older people and average of ages\nname=(\"reza\",\"ali\",\"sara\",\"elham\",\"majid\")\nage=(30,34,28,25,40)\nave=0\npeyvast=list(zip(name,age))\nprint(peyvast)\nprint()\nprint(\"The older people than 30 are:\")\n#loop for finding older people than 30years\nfor i in range(len(age)):\n    if age[i]>=30:\n      print(name[i],age[i])\nprint()\n#loop for find average of ages\nfor i in range(len(age)):\n    ave+=age[i]\nave=ave/len(age)\nprint(\"The average of people is:\",ave)","metadata":{"execution":{"iopub.status.busy":"2023-07-22T08:23:47.034840Z","iopub.execute_input":"2023-07-22T08:23:47.035312Z","iopub.status.idle":"2023-07-22T08:23:47.046926Z","shell.execute_reply.started":"2023-07-22T08:23:47.035276Z","shell.execute_reply":"2023-07-22T08:23:47.045239Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Name&age (type2)\nname=[]\nage=[]\nave=0\nfor n in range(5):\n    t=str(input(\"Enter the person name:\"))\n    name.append(t)\n    y=int(input(\"Enter the person age:\"))\n    age.append(y)\nname_age=list(zip(name,age))\nprint(\"persons name&age are:\")\nprint(name_age)\n#loop for finding older people than 30years\nfor i in range(len(age)):\n    if age[i]>=30:\n      print(name[i],age[i])\nprint()\n#loop for find average of ages\nfor i in range(len(age)):\n    ave+=age[i]\nave=ave/len(age)\nprint(\"The average of people is:\",ave)","metadata":{"execution":{"iopub.status.busy":"2023-07-22T15:28:19.764239Z","iopub.execute_input":"2023-07-22T15:28:19.765307Z","iopub.status.idle":"2023-07-22T15:28:34.741812Z","shell.execute_reply.started":"2023-07-22T15:28:19.765255Z","shell.execute_reply":"2023-07-22T15:28:34.740600Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#print Triangle\ni=1\nj=50\nfor n in range(10):\n    print(\" \"*j+\"*\"*i)\n    j-=2\n    i+=4","metadata":{"execution":{"iopub.status.busy":"2023-07-22T15:13:04.952729Z","iopub.execute_input":"2023-07-22T15:13:04.953084Z","iopub.status.idle":"2023-07-22T15:13:04.959576Z","shell.execute_reply.started":"2023-07-22T15:13:04.953057Z","shell.execute_reply":"2023-07-22T15:13:04.958328Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#print Diamond\ni=1j-=1\nj=50\nfor n in range(10):\n    print(\" \"*j+\"*\"*i)\n      i+=2\nfor n in range(11):\n    print(\" \"*j+\"*\"*i)\n    j+=1\n    i-=2","metadata":{"execution":{"iopub.status.busy":"2023-07-22T15:19:16.637608Z","iopub.execute_input":"2023-07-22T15:19:16.637950Z","iopub.status.idle":"2023-07-22T15:19:16.644139Z","shell.execute_reply.started":"2023-07-22T15:19:16.637923Z","shell.execute_reply":"2023-07-22T15:19:16.642826Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def adad() :\n    a=int(input(\"ebtedaye baze ra vared konid:\"))\n    b=int(input(\"entehaye baze ra vared konid:\"))\n    return(a,b)\ndef aval(a,b):\n    for n in range(a,b):\n        check=0\n        for i in range(n):\n            if n//m:\n                check+=1\n                \n","metadata":{"execution":{"iopub.status.busy":"2023-07-24T19:03:06.877292Z","iopub.execute_input":"2023-07-24T19:03:06.877770Z","iopub.status.idle":"2023-07-24T19:03:14.057976Z","shell.execute_reply.started":"2023-07-24T19:03:06.877736Z","shell.execute_reply":"2023-07-24T19:03:14.056564Z"},"trusted":true},"execution_count":null,"outputs":[]}]}