X Tutup
{ "cells": [ { "cell_type": "markdown", "id": "48e4a740-ff4d-407d-aa90-d2a08f3663c8", "metadata": {}, "source": [ "# Welcome to Data Engineering" ] }, { "cell_type": "code", "execution_count": 2, "id": "c7aa127c-d516-4c16-aa64-eae7ff88539c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Welcome to Data Engineering with Python 3.13\n" ] } ], "source": [ "print('Welcome to Data Engineering with Python 3.13')" ] }, { "cell_type": "code", "execution_count": 4, "id": "5382e715-2f4e-43f9-a3ad-b64c0421af9a", "metadata": {}, "outputs": [], "source": [ "x = 2" ] }, { "cell_type": "code", "execution_count": 7, "id": "27cf2578-848d-4709-8375-6995f6d5d0cc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2\n" ] } ], "source": [ "print(x)" ] }, { "cell_type": "code", "execution_count": 8, "id": "b396299f-8324-4a95-8cff-667afbe26d2e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "int" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(x)" ] }, { "cell_type": "code", "execution_count": 9, "id": "f2d2644e-dd9f-497c-938d-2354b900598c", "metadata": {}, "outputs": [], "source": [ "y = \"This is a DS Class\"" ] }, { "cell_type": "code", "execution_count": 10, "id": "e1e3e758-efd5-4566-90bc-33789ed40884", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "str" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(y)" ] }, { "cell_type": "code", "execution_count": 11, "id": "e3ce71f2-3644-4157-a2f6-3afdc7c9b409", "metadata": {}, "outputs": [], "source": [ "y = \"This is a Jupyter Notebook\"" ] }, { "cell_type": "code", "execution_count": 12, "id": "0e03e988-b7d2-47d9-840f-b0013733ba10", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This is a Jupyter Notebook\n" ] } ], "source": [ "print(y)" ] }, { "cell_type": "code", "execution_count": 15, "id": "d47dcfe8-522b-41bd-8925-dfc571577eed", "metadata": {}, "outputs": [], "source": [ "x,y,z = 'Student-1', 'Student-2', 'Student-3'\n" ] }, { "cell_type": "code", "execution_count": 16, "id": "ccde8024-98f6-4bc5-a287-6a3e537177ce", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Student-1\n", "Student-2\n", "Student-3\n" ] } ], "source": [ "print(x)\n", "print(y)\n", "print(z)" ] }, { "cell_type": "code", "execution_count": 18, "id": "21f9c507-6237-449a-beec-df9339ef4723", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Student-4', 'Student-5', 'Student-6']\n" ] } ], "source": [ "list = ['Student-4','Student-5','Student-6']\n", "print(list)" ] }, { "cell_type": "code", "execution_count": 19, "id": "be05f020-72b7-4d47-9abf-2e6e8f5f1860", "metadata": {}, "outputs": [], "source": [ "x,y,z= list" ] }, { "cell_type": "code", "execution_count": 20, "id": "d593a77c-ca4b-4efd-b466-5e2262b2950b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Student-4\n", "Student-5\n", "Student-6\n" ] } ], "source": [ "print(x)\n", "print(y)\n", "print(z)" ] }, { "cell_type": "code", "execution_count": 21, "id": "c136e118-86e8-49ec-bfee-55b54902926f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "10\n" ] }, { "data": { "text/plain": [ "int" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x = 10\n", "print(x)\n", "type(x)" ] }, { "cell_type": "code", "execution_count": null, "id": "a0fbf148-49fc-45d3-9b61-ebdba8511278", "metadata": {}, "outputs": [], "source": [ "x = \"Hello\"\n", "print(x)\n", "type(x)" ] }, { "cell_type": "code", "execution_count": null, "id": "b2bdd9cf-951c-4a04-8168-08a9fa104a13", "metadata": {}, "outputs": [], "source": [ "student_name = \"john\"\n", "student_mail = \"abc@mail.com\"\n", "student_mail_address = \"xyz\"" ] }, { "cell_type": "code", "execution_count": 26, "id": "69a15106-b8fc-4fb5-8d74-d270dfe1478e", "metadata": {}, "outputs": [], "source": [ "name = \"Goutham\" + \"-\" + \"Kumar\"" ] }, { "cell_type": "code", "execution_count": 27, "id": "51165fd1-d133-4166-a58d-f295ea801896", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Goutham-Kumar\n" ] } ], "source": [ "print(name)" ] }, { "cell_type": "code", "execution_count": 28, "id": "4bc99277-4272-45a2-8c2f-afe82441ae1e", "metadata": {}, "outputs": [], "source": [ "pi = 3.142" ] }, { "cell_type": "code", "execution_count": 29, "id": "342c66e8-c386-45cc-9bcc-b8ed089cf3ec", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "float" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(pi)" ] }, { "cell_type": "code", "execution_count": 32, "id": "3302b469-885c-47b0-b3ba-c098756eec19", "metadata": {}, "outputs": [], "source": [ "is_student = True\n", "has_email = False\n", "is_valid = 1 > 3" ] }, { "cell_type": "code", "execution_count": null, "id": "9873a392-ec92-4247-ab60-f9b9284a8fe8", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 33, "id": "2cf28894-8141-4702-b7d3-4c180e7df8ef", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "False\n" ] } ], "source": [ "print(is_valid)" ] }, { "cell_type": "code", "execution_count": null, "id": "958a6a4b-f425-479d-b388-764533ae4979", "metadata": {}, "outputs": [], "source": [ "help(str)" ] }, { "cell_type": "code", "execution_count": 35, "id": "4ecc62c4-3689-43d6-95a5-048bd4e97b39", "metadata": {}, "outputs": [], "source": [ "name = \" Goutham Kumar ABC \"" ] }, { "cell_type": "code", "execution_count": 36, "id": "0a614770-865a-45a7-b085-37bf4655c833", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "19\n" ] } ], "source": [ "print(len(name))" ] }, { "cell_type": "code", "execution_count": 37, "id": "fa8fa1ce-74f5-4dc0-833d-9db5816ebd1d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " GOUTHAM KUMAR ABC \n", " goutham kumar abc \n", "Goutham Kumar ABC\n", "Goutham Kumar ABC \n", " Goutham Kumar ABC\n" ] } ], "source": [ "print(name.upper())\n", "print(name.lower())\n", "print(name.strip())\n", "print(name.lstrip())\n", "print(name.rstrip())" ] }, { "cell_type": "code", "execution_count": 40, "id": "d53851e9-0350-4768-80a3-a42b8bcbd279", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "apple:banana:cherry\n", "['apple', 'banana', 'cherry']\n" ] } ], "source": [ "csv_data = \"apple:banana:cherry\"\n", "print(csv_data)\n", "\n", "print(csv_data.split(':'))" ] }, { "cell_type": "code", "execution_count": 41, "id": "cf8f6eff-4f89-49dc-aa2f-e4c6b52489c6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "aaple,banana,cherry\n" ] } ], "source": [ "join_data = ['aaple', 'banana', 'cherry']\n", "\n", "print(\",\".join(join_data))" ] }, { "cell_type": "code", "execution_count": 44, "id": "0ab28216-fc7d-4fc3-8140-cca6324be098", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"students\".find(\"t\")" ] }, { "cell_type": "code", "execution_count": 45, "id": "218b5ffe-b996-44a0-b40a-39f2bda34f8d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"banana\".count(\"a\")" ] }, { "cell_type": "code", "execution_count": 64, "id": "e44afa64-9bb9-4bd6-af04-4868aff94d17", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"welcome\".startswith(\"we\")" ] }, { "cell_type": "code", "execution_count": 73, "id": "93fbb6d2-3b84-4c25-9aa3-d64809cbaa32", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n" ] } ], "source": [ "text = \"hello world\"\n", "\n", "print(text.endswith(\"world\", 6, 11))" ] }, { "cell_type": "code", "execution_count": 50, "id": "ccb62f33-c10d-415f-8f6d-ce974ab1dd4f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Welcome To Ds'" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"welcome to ds\".title()" ] }, { "cell_type": "code", "execution_count": 52, "id": "c3c0432c-5f2f-42fd-a64c-64247dd517b0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hello, my name is Goutham and my age is 30\n" ] } ], "source": [ "name = \"Goutham\"\n", "age = 30\n", "\n", "print(f\"Hello, my name is {name} and my age is {age}\")" ] }, { "cell_type": "code", "execution_count": 59, "id": "8effc10d-c9fc-41b1-a33a-b78db3016ef1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "False\n", "True\n" ] } ], "source": [ "print(\"1Student\".isalpha())\n", "print(\"Student\".isalpha())" ] }, { "cell_type": "code", "execution_count": 54, "id": "08d9ced1-15b8-4954-9ed2-cb42372522c4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"1234\".isdigit()" ] }, { "cell_type": "code", "execution_count": 61, "id": "5a3204a0-42d4-488b-8207-2f9f58d0e1c2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 61, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\"student12@\".isalnum()" ] }, { "cell_type": "code", "execution_count": 58, "id": "9f0d6784-b23c-40a4-b363-f8d40bf6b3af", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[5, 4, 3, 2, 1]\n" ] } ], "source": [ "list = [1,2,3,4,5]\n", "\n", "# builtin methods and use python langauge features\n", "\n", "list.reverse()\n", "print(list)" ] }, { "cell_type": "code", "execution_count": 74, "id": "223b4a23-d646-4f5d-a79d-878a79c78f45", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[5, 4, 3, 2, 1]\n" ] } ], "source": [ "list = [1,2,3,4,5]\n", "\n", "# builtin methods and use python langauge features\n", "\n", "rev_list = list[::-1]\n", "print(rev_list)" ] }, { "cell_type": "code", "execution_count": null, "id": "ff7cf34e-a0fd-424f-8e6e-120fa3755ed2", "metadata": {}, "outputs": [], "source": [ "my_list = [1,2,3,4,5]\n", "\n", "def reverse_list(list):\n", " start = 0\n", " end = len(list) - 1\n", " \n", " while start < end:\n", " list[start], list[end] = list[end], list[start]\n", " start += 1\n", " end -= 1\n", " return list\n", "\n", "rev_list = reverse_list(my_list)\n", "\n", "print (rev_list)" ] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:base] *", "language": "python", "name": "conda-base-py" }, "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.13.5" } }, "nbformat": 4, "nbformat_minor": 5 }
X Tutup