{"id":1812,"date":"2019-01-15T14:32:01","date_gmt":"2019-01-15T07:32:01","guid":{"rendered":"https:\/\/luckytruedev.com\/learning\/?p=1812"},"modified":"2019-09-21T21:34:07","modified_gmt":"2019-09-21T14:34:07","slug":"percabangan-pada-python","status":"publish","type":"post","link":"https:\/\/luckytruedev.com\/learning\/percabangan-pada-python\/","title":{"rendered":"Percabangan pada Python"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"416\" src=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/python_ifelse.jpg\" alt=\"\" class=\"wp-image-1813\" srcset=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/python_ifelse.jpg 651w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/python_ifelse-300x192.jpg 300w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/python_ifelse-110x70.jpg 110w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/python_ifelse-420x268.jpg 420w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/python_ifelse-20x13.jpg 20w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/figure><\/div>\n\n\n\n<p>Hi, Kali ini gw mau share Cara membuat Percabangan menggunakan bahasa Python, langsung aja gw kasih contoh-contoh dari Percabangan dengan mudah agar kalian dapat mempelajarinya.<\/p>\n\n\n<div id=\"lucky-3812731034\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-5605825534849002\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-5605825534849002\" \ndata-ad-slot=\"5317815257\" \ndata-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>Menentukan Bilangan Genap &amp; Ganjil<\/strong><\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"328\" height=\"138\" src=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.36.png\" alt=\"\" class=\"wp-image-1865\" srcset=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.36.png 328w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.36-300x126.png 300w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.36-110x46.png 110w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.36-20x8.png 20w\" sizes=\"auto, (max-width: 328px) 100vw, 328px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">n = int(input(\"n :\"))\nif(n%2==1) :\n        print('ganjil')\nelse :\n        print('genap')<\/pre>\n\n\n\n<p>Penjelasan pada contoh program diatas :<br><br>Membuat Sebuah Percabangan, kalian hanya perlu mengetikan pada editor Pycharm atau IDLE python kalian.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">VARIABEL --> n\nINPUT BILANGAN --> int(input(\"n :\"))\nASUMSI JIKA GANJIL --> if(n%2==1) :\n        print('ganjil')\nASUMSI JIKA GENAP --> else :\n        print('genap')\nOUTPUT --> print()<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Menentukan Nilai Siswa<\/strong><\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"295\" height=\"135\" src=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.14.png\" alt=\"\" class=\"wp-image-1866\" srcset=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.14.png 295w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.14-110x50.png 110w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.14-20x9.png 20w\" sizes=\"auto, (max-width: 295px) 100vw, 295px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">n = int(input(\"nilai :\"))\nif (n>80) :\n    hasil=\"A\"\nelif (n>60) and (n&lt;=80) :\n    hasil=\"B\"\nelif (n>50) and (n&lt;=60) :\n    hasil=\"C\"\nelse :\n    hasil=\"D\"\nprint(hasil)<\/pre>\n\n\n\n<p>Penjelasan pada contoh program diatas :<br><br>Membuat Sebuah Percabangan, kalian hanya perlu mengetikan pada editor Pycharm atau IDLE python kalian.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">VARIABEL --> n\nINPUT BILANGAN --> int(input(\"nilai :\"))\nASUMSI JIKA MENDAPAT A --> if (n>80) :\n    hasil=\"A\"\nASUMSI JIKA TIDAK MENDAPAT A TETAPI DAPAT B --> elif (n>60) and (n&lt;=80) :\n    hasil=\"B\"\nASUMSI JIKA TIDAK MENDAPAT B TETAPI DAPAT C -->elif (n>50) and (n&lt;=60) :\n    hasil=\"C\"\nASUMSI JIKA MENDAPAT D --> else :\n    hasil=\"D\"\nOUTPUT --> print(hasil)<\/pre>\n\n\n<div id=\"lucky-3410903709\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-5605825534849002\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-5605825534849002\" \ndata-ad-slot=\"3760179245\" \ndata-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>Menentukan Batasan Usia untuk mendapat SIM<\/strong><\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"497\" height=\"150\" src=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.35.png\" alt=\"\" class=\"wp-image-1871\" srcset=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.35.png 497w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.35-300x91.png 300w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.35-110x33.png 110w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.35-420x127.png 420w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.29.35-20x6.png 20w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">umur = int(input(\"umur : \"))\nnilaites = int(input(\"nilaites : \"))\nif umur > 17:\n    if nilaites > 80:\n        hasil = (\"Selamat anda berhak mendapatkan SIM\")\n    else:\n        hasil = (\"Maaf anda tidak berhak mendapatkan SIM, Nilai test anda kurang\")\nelif umur == 17:\n    if nilaites > 80:\n        hasil = (\"Maaf anda tidak berhak mendapatkan SIM, umur anda belum mencukupi\")\n    elif nilaites &lt; 80:\n        hasil = (\"Maaf anda tidak berhak mendapatkan SIM, umur dan nilai belum mencukupi\")\nelif umur &lt; 17:\n    if nilaites &lt; 80:\n        hasil = (\"maaf anda tidak lulus karena nilai dan umur tidak mencukupi\")\nprint(hasil)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Menentukan Nilai Tes SIM<\/strong><\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"302\" height=\"143\" src=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.14.png\" alt=\"\" class=\"wp-image-1867\" srcset=\"https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.14.png 302w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.14-300x143.png 300w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.14-110x52.png 110w, https:\/\/luckytruedev.com\/learning\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-15-at-14.28.14-20x9.png 20w\" sizes=\"auto, (max-width: 302px) 100vw, 302px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">umur = int(input(\"umur :\"))\nnilai = int(input(\"nilai tes :\"))\nif (umur>17) :\n    if (nilai>80):\n            hasil=(\"Selamat\")\n    else :\n            hasil=(\"Maaf\")\nelse :\n    hasil=(\"GAGAL\")\nprint(hasil)<\/pre>\n\n\n\n<p>Penjelasan pada contoh program diatas :<br><br>Membuat Sebuah Percabangan, kalian hanya perlu mengetikan pada editor Pycharm atau IDLE python kalian.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">VARIABEL --> umur, nilai, hasil\nINPUT BILANGAN --> int(input(\"umur :\"))\nJIKA BERUMUR 17 &amp; MENDAPAT NILAI 80 --> if (umur>17) :\n    if (nilai>80):\n            hasil=(\"Selamat\")\n    else :\n            hasil=(\"Maaf\")\nJIKA DIBAWAH 17 DAN NILAI DIBAWAH 80 --> else :\n    hasil=(\"GAGAL\")\nOUTPUT --> print(hasil)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Source Code?<\/strong><\/h2>\n\n\n\n<p>Silahkan Kalian Cek pada Situs ini : <br><br>&#8211; <a href=\"https:\/\/github.com\/poncoe\/python_basic\/tree\/master\/bab2_if-else\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/poncoe\/python_basic\/tree\/master\/bab2_if-else<\/a><br>&#8211; <a href=\"https:\/\/github.com\/poncoe\/python_basic\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/poncoe\/python_basic<\/a><\/p>\n<div id=\"lucky-3679892271\" class=\"lucky-after-content lucky-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-5605825534849002\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-5605825534849002\" \ndata-ad-slot=\"5317815257\" \ndata-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Hi, Kali ini gw mau share Cara membuat Percabangan menggunakan bahasa Python, langsung aja gw kasih contoh-contoh dari Percabangan dengan mudah agar kalian dapat mempelajarinya. Menentukan Bilangan Genap &amp; Ganjil Penjelasan pada contoh program diatas : Membuat Sebuah Percabangan, kalian hanya perlu mengetikan pada editor Pycharm atau IDLE python kalian. Menentukan Nilai Siswa Penjelasan pada [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1813,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[],"class_list":["post-1812","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ltdv-python"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/posts\/1812","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/comments?post=1812"}],"version-history":[{"count":2,"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/posts\/1812\/revisions"}],"predecessor-version":[{"id":2265,"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/posts\/1812\/revisions\/2265"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/media\/1813"}],"wp:attachment":[{"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/media?parent=1812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/categories?post=1812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/luckytruedev.com\/learning\/wp-json\/wp\/v2\/tags?post=1812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}