{ "nbformat": 4, "nbformat_minor": 5, "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.8" }, "colab": { "name": "Introduction-Python.ipynb", "provenance": [], "include_colab_link": true } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "edP37gG0o4Oa" }, "source": [ "Senin, 13 Sept 2021" ], "id": "edP37gG0o4Oa" }, { "cell_type": "markdown", "metadata": { "id": "9BnrYww4QfS5" }, "source": [ "**Perintah 1**" ], "id": "9BnrYww4QfS5" }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "7e0852e7", "outputId": "3997a019-350f-40e0-e277-55c983228b86" }, "source": [ "print(\"Hello World\")" ], "id": "7e0852e7", "execution_count": 1, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Hello World\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "q6HTu5ooQpbL" }, "source": [ "**Perintah 2**" ], "id": "q6HTu5ooQpbL" }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "90ab46c9", "outputId": "d689df22-4bf2-48cd-da2d-199550b7f164" }, "source": [ "print(\"Hallo Dunia\")\n", "print(\"Riset Bahasa\")" ], "id": "90ab46c9", "execution_count": 2, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Hallo Dunia\n", "Riset Bahasa\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "mYY5iXiZQ4VK" }, "source": [ "**Perintah 3**" ], "id": "mYY5iXiZQ4VK" }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "45116403", "outputId": "85fcef82-764c-4819-a35d-fd25dc9ff329" }, "source": [ "bilangan1 = 20\n", "bilangan2 = 10\n", "print(bilangan1 - bilangan2)" ], "id": "45116403", "execution_count": 3, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "10\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "_zJxr0VlRBca" }, "source": [ "**Perintah 4**" ], "id": "_zJxr0VlRBca" }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "8b2872ce", "outputId": "e63d6982-8d61-4820-f9dc-0e2a9db9863c" }, "source": [ "contoh_list = ['Dewi','Budi','Cici','Linda','Cici']\n", "print(contoh_list)\n", "contoh_set = {'Dewi','Budi','Cici','Linda','Cici'}\n", "print(contoh_set)\n", "contoh_frozen_set = ({'Dewi','Budi','Cici','Linda','Cici'})\n", "print(contoh_frozen_set)" ], "id": "8b2872ce", "execution_count": 4, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "['Dewi', 'Budi', 'Cici', 'Linda', 'Cici']\n", "{'Linda', 'Dewi', 'Budi', 'Cici'}\n", "{'Linda', 'Dewi', 'Budi', 'Cici'}\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "Px0Pkqt9RND_" }, "source": [ "**Perintah 5**" ], "id": "Px0Pkqt9RND_" }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "d77f6a86", "outputId": "4e0618a2-c2d3-482f-838d-39b9bbace49b" }, "source": [ "person = {'nama':'Risky David','pekerjaan':'Mahasiswa aktif IT Telkom Purwokerto'}\n", "print(person['nama'])\n", "print(person['pekerjaan'])" ], "id": "d77f6a86", "execution_count": 5, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Risky David\n", "Mahasiswa aktif IT Telkom Purwokerto\n" ] } ] }, { "cell_type": "markdown", "metadata": { "id": "w2N-WU0ZRVv_" }, "source": [ "**Perintah 6**" ], "id": "w2N-WU0ZRVv_" }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "626428b9", "outputId": "e4ca509b-3a09-45a3-f7a3-57bf5cd43510" }, "source": [ "contoh_list = [1, 'dua', 3, 4.0, 5]\n", "print(contoh_list[0])\n", "print(contoh_list[3])\n", "contoh_list = [1, 'dua', 3, 4.0, 5]\n", "contoh_list[3] = 'empat'\n", "print(contoh_list[3])" ], "id": "626428b9", "execution_count": 6, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "1\n", "4.0\n", "empat\n" ] } ] } ] }