{"id":119,"date":"2019-11-15T15:57:28","date_gmt":"2019-11-15T06:57:28","guid":{"rendered":"http:\/\/aiacademy.jp\/media\/?p=119"},"modified":"2024-08-08T15:52:49","modified_gmt":"2024-08-08T06:52:49","slug":"python%e3%81%ae2%e7%b3%bb%e3%81%a83%e7%b3%bb%e3%81%ae%e9%81%95%e3%81%84%e3%81%af%ef%bc%9fpython%e3%81%ae%e5%9f%ba%e6%9c%ac%e3%82%92%e5%ad%a6%e3%81%bc%e3%81%86%ef%bc%81","status":"publish","type":"post","link":"https:\/\/aiacademy.jp\/media\/?p=119","title":{"rendered":"Python\u306e2\u7cfb\u30683\u7cfb\u306e\u9055\u3044\u306f\uff1fPython\u306e\u57fa\u672c\u3092\u5b66\u307c\u3046\uff01"},"content":{"rendered":"<div id=\"sgb-css-id-1\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-font-size is-style-fill has-medium-font-size\"><a class=\"wp-block-button__link has-vivid-green-cyan-background-color has-background wp-element-button\" href=\"https:\/\/lin.ee\/3E4GzWk\" rel=\"nofollow noopener\" target=\"_blank\">LINE\u53cb\u3060\u3061\u767b\u9332 \u25b6 Python\u30b3\u30fc\u30b9 \u25b6 \u53d7\u8b1b\u5272\u5f15\u30af\u30fc\u30dd\u30f3 \u7121\u6599\u52d5\u753b<\/a><\/div>\n<\/div>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/aiacademy.jp\/bootcamp\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-1024x341.png\" alt=\"\" class=\"wp-image-691\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-1024x341.png 1024w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-300x100.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-768x256.png 768w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-940x313.png 940w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\"><\/a><\/figure>\n\n\n<div class=\"toc\">    <div id=\"toc_container\" class=\"sgb-toc--no-bullets js-smooth-scroll\" data-dialog-title=\"Table of Contents\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">\u306f\u3058\u3081\u306b<\/a>  <\/li>  <li>    <a href=\"#i-1\">Python\u3068\u306f<\/a>  <\/li>  <li>    <a href=\"#i-2\">Python2\u7cfb\u30683\u7cfb\u306e\u9055\u3044<\/a>  <\/li>  <li>    <a href=\"#i-3\">PEP8<\/a>  <\/li>  <li>    <a href=\"#i-4\">\u6587\u5b57\u5217\u3068\u306f<\/a>  <\/li>  <li>    <a href=\"#i-5\">\u30b3\u30e1\u30f3\u30c8<\/a>  <\/li>  <li>    <a href=\"#i-6\">\u6570\u5024<\/a>  <\/li>  <li>    <a href=\"#i-7\">\u6587\u5b57\u5217\u3068\u6570\u5024\u306e\u9055\u3044<\/a>  <\/li>  <li>    <a href=\"#i-8\">\u5909\u6570\u3068\u306f<\/a>  <\/li>  <li>    <a href=\"#i-9\">\u6587\u5b57\u5217\u306e\u9023\u7d50<\/a>  <\/li>  <li class=\"last\">    <a href=\"#i-10\">\u307e\u3068\u3081<\/a>  <\/li><\/ul>\n      \n    <\/div><\/div><div class=\"toc\"><p><\/p>\n<\/div><h2 id=\"i-0\">\u306f\u3058\u3081\u306b<\/h2>\n<p>\u3053\u306e\u7ae0\u304b\u3089\u3001\u5b9f\u969b\u306bPython\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u3044\u304d\u307e\u3059\u306e\u3067\u3001<strong>\u65e2\u306bPython\u306e\u74b0\u5883\u69cb\u7bc9\u304c\u3067\u304d\u3066\u3044\u308b\u524d\u63d0\u3067\u9032\u3081\u307e\u3059\u3002<\/strong>\u74b0\u5883\u69cb\u7bc9\u304c\u3067\u304d\u3066\u3044\u306a\u3044\u65b9\u306f\u3001<a href=\"https:\/\/aiacademy.jp\/texts\/#dev\">Python\u958b\u767a\u74b0\u5883\u7de8<\/a>\u3092\u5148\u306b\u5b8c\u4e86\u3057\u3066\u9032\u3081\u3066\u304f\u3060\u3055\u3044\u3002<br>\u4eca\u3059\u3050\u306bPython\u3092\u59cb\u3081\u305f\u3044\u65b9\u306f\u3001<a href=\"https:\/\/colab.research.google.com\/\" rel=\"nofollow noopener\" target=\"_blank\">Google Colab(\u7121\u6599)<\/a>\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3059\u3050\u306bPython\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u59cb\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 id=\"i-1\">Python\u3068\u306f<\/h2>\n<p>Python\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u7406\u89e3\u3057\u3084\u3059\u3044\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\u3002<br>Python\u3092\u4f7f\u3046\u3068Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u3001\u6a5f\u68b0\u5b66\u7fd2\u3001\u7d71\u8a08\u51e6\u7406\u306a\u3069\u69d8\u3005\u306a\u3053\u3068\u306b\u4f7f\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br>Google\u3084DropBox\u3001Facebook\u306a\u3069\u69d8\u3005\u306a\u4f01\u696d\u3067\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.python.org\/\" rel=\"nofollow noopener\" target=\"_blank\">\u516c\u5f0f\u30b5\u30a4\u30c8<\/a><\/p>\n<h2 id=\"i-2\">Python2\u7cfb\u30683\u7cfb\u306e\u9055\u3044<\/h2>\n<p>\u5909\u66f4\u70b9\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u304c\u3001print\u6587\u304cprint()\u95a2\u6570\u306b\u5909\u66f4\u3055\u308c\u305f\u3053\u3068\u3084\u3001long\u578b\u304c\u5ec3\u6b62\u3055\u308cint\u578b\u3068\u3057\u3066\u6271\u308f\u308c\u305f\u308a\u306a\u3069\u3042\u308a\u307e\u3059\u3002<br>Python2\u7cfb\u306f2020\u5e74\u306b\u3066<a href=\"https:\/\/python3statement.org\/\" rel=\"nofollow noopener\" target=\"_blank\">\u30b5\u30dd\u30fc\u30c8\u7d42\u4e86<\/a>\u3067\u3059\u306e\u3067\u3001\u3053\u308c\u304b\u3089\u59cb\u3081\u308b\u65b9\u306fPython3\u7cfb\u3092\u9078\u3076\u306e\u304c\u826f\u3044\u3067\u3059\u3002<\/p>\n<h2 id=\"i-3\">PEP8<\/h2>\n<p>PEP8\u306f\u3001Python \u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u898f\u7d04\u306b\u306a\u308a\u307e\u3059\u3002<br>Python\u3067\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u59cb\u3081\u308b\u306b\u3042\u305f\u3063\u3066\u3001\u305d\u306e\u90fd\u5ea6\u76ee\u3092\u901a\u3057\u3066\u9802\u3051\u305f\u3089\u3068\u601d\u3044\u307e\u3059\u3002<br><a href=\"https:\/\/pep8-ja.readthedocs.io\/ja\/latest\/\" rel=\"nofollow noopener\" target=\"_blank\">PEP8<\/a><\/p>\n<h2 id=\"i-4\">\u6587\u5b57\u5217\u3068\u306f<\/h2>\n<p>\u6587\u5b57\u5217\u306f\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c\u201d\u300d\u307e\u305f\u306f\u3001\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c\u2019\u300d\u3067\u56f2\u307e\u308c\u305f\u6587\u5b57\u306f\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u4e16\u754c\u3067\u300c\u6587\u5b57\u5217\u300d\u3068\u547c\u3073\u307e\u3059\u3002<br><strong><em>\u6587\u5b57\u5217\u306f\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c\u2019\u300d\u3001\u307e\u305f\u306f\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c\u201d\u300d\u3067\u56f2\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/em><\/strong><br>Python3\u3067\u306f\u3069\u3061\u3089\u3067\u56f2\u3093\u3067\u3082\u51fa\u529b\u7d50\u679c\u306f\u540c\u3058\u3067\u3059\u3002<br>\u307e\u305f\u3001\u6587\u5b57\u5217\u3092\u51fa\u529b\u3059\u308b\u969b\u306b\u3001\u300c\u2019\u300d\u3001\u300c\u201d\u300d\u3067\u56f2\u3093\u3067\u3044\u306a\u3044\u5834\u5408\u3001\u30b3\u30fc\u30c9\u304c\u52d5\u304b\u306a\u304f\u306a\u308a\u307e\u3059\u3002<br>\u4f59\u529b\u304c\u3042\u308b\u65b9\u306f\u3001\u30a8\u30e9\u30fc(SyntaxErrror)\u3092\u51fa\u3057\u3066\u3001\u30b3\u30fc\u30c9\u304c\u52d5\u304b\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br>\u3053\u3053\u3067\u306f\u3001\u300c\u2019\u300d\u3084\u300c\u201d\u300d\u3067\u56f2\u307e\u306a\u3044\u5834\u5408\u306b\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3001\u52d5\u304b\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3088\u308a\u7406\u89e3\u51fa\u6765\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30fb<a href=\"http:\/\/d.hatena.ne.jp\/climpy\/20090913\/1252806499\" rel=\"nofollow noopener\" target=\"_blank\">\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c\u2019\u300d\u3001\u307e\u305f\u306f\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c\u201d\u300d\u306e\u9055\u3044\u3001\u4f7f\u3044\u5206\u3051<\/a><br>\u30fb<a href=\"http:\/\/nonbiri-tereka.hatenablog.com\/entry\/2014\/06\/02\/083206\" rel=\"nofollow noopener\" target=\"_blank\">\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\uff08\u4f8b\u3048\u3070\u3001SyntaxError)\u306e\u7a2e\u985e\u306b\u3064\u3044\u3066<\/a><\/p>\n<h2 id=\"i-5\">\u30b3\u30e1\u30f3\u30c8<\/h2>\n<p>\u30b3\u30fc\u30c9\u306e\u4e2d\u306b\u306f\u30b3\u30e1\u30f3\u30c8\u3092\u66f8\u304f\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br>\u884c\u982d\u306b\u300c#\u300d\u3092\u66f8\u304f\u3053\u3068\u3067\u884c\u672b\u307e\u3067\u30b3\u30e1\u30f3\u30c8\u3068\u307f\u306a\u3055\u308c\u307e\u3059\u3002<br><strong><em>\u30b3\u30e1\u30f3\u30c8\u3092\u66f8\u304f\u3053\u3068\u3067\u3001\u30b3\u30fc\u30c9\u304c\u5b9f\u884c\u3055\u308c\u308b\u6642\u306b\u5168\u3066\u7121\u8996\u3055\u308c\u308b\u306e\u3067\u3001\u30b3\u30fc\u30c9\u306b\u95a2\u3059\u308b\u30e1\u30e2\u306a\u3069\u3068\u3057\u3066\u4f7f\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/em><\/strong><br>\u696d\u52d9\u3067\u306f\u3001\u8907\u6570\u4eba\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u308b\u3053\u3068\u304c\u307b\u3068\u3093\u3069\u3067\u3059\u3002<br>\u305d\u306e\u305f\u3081\u3001<strong><em>\u5e38\u65e5\u9803\u304b\u3089\u4ed6\u4eba\u304c\u30b3\u30fc\u30c9\u3092\u8aad\u3080\u3068\u304d\u306b\u8aad\u307f\u3084\u3059\u3044\u3088\u3046\u306b\u30b3\u30e1\u30f3\u30c8\u3092\u6b8b\u3057\u3066\u304a\u304f\u3053\u3068\u306f\u5927\u4e8b\u3067\u3059\u3002<\/em><\/strong><br>\u306a\u308b\u3079\u304f\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u306b\u306f\u4ed6\u4eba\u304c\u8aad\u307f\u3084\u3059\u3044\u3088\u3046\u306b\u3001\u30b3\u30e1\u30f3\u30c8\u3092\u66f8\u304f\u7fd2\u6163\u3092\u3064\u3051\u308b\u3053\u3068\u3092\u30aa\u30b9\u30b9\u30e1\u81f4\u3057\u307e\u3059\u3002<\/p>\n<pre><code># \u3053\u306e\u884c\u306f\u30b3\u30e1\u30f3\u30c8\u3067\u3059\u3002\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002\n\nprint(\"Hello, Python\") \n\n# \u3053\u306e\u884c\u306f\u8907\u6570\u884c\u30b3\u30e1\u30f3\u30c8\u3067\u3059\u3002\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002\n# \u3053\u306e\u884c\u306f\u8907\u6570\u884c\u30b3\u30e1\u30f3\u30c8\u3067\u3059\u3002\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002\n<\/code><\/pre>\n<p>\u307e\u305f\u3001\u4f59\u529b\u304c\u3042\u308b\u65b9\u306f\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3001\u30b3\u30e1\u30f3\u30c8\u3057\u305f\u8a18\u8ff0\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2 id=\"i-6\">\u6570\u5024<\/h2>\n<p>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067\u306f\u3001\u300c\u6570\u5024\u300d\u3092\u6271\u3046\u3053\u3068\u3082\u51fa\u6765\u307e\u3059\u3002<br>\u6587\u5b57\u5217\u3068\u9055\u3044\u3001\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u3002<br><strong><em>\u6570\u5b57\u3092\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u53ca\u3073\u3001\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3080\u3068\u6587\u5b57\u5217\u306b\u306a\u308b\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002<\/em><\/strong><br>\u8a73\u3057\u304f\u306f\u6b21\u7ae0\u3001\u300c\u5909\u6570\u3068\u30c7\u30fc\u30bf\u578b\u300d\u3067\u8a73\u3057\u304f\u8aac\u660e\u81f4\u3057\u307e\u3059\u3002<br>\u307e\u305f\u3001\u300c+\u300d\u3001\u300c-\u300d\u3001\u300c\/\u300d\u3001\u300c%\u300d\u3068\u884c\u3063\u305f\u8a18\u53f7\u3092\u4f7f\u3046\u3053\u3068\u3067\u56db\u5247\u6f14\u7b97\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br>\u56db\u5247\u6f14\u7b97\u304c\u51fa\u6765\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u3001\u96fb\u5353\u3068\u540c\u69d8\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code>print(10) # \u6570\u5024\u306f\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3080\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\nprint(10 + 5) # \u8db3\u3057\u3066\u3044\u308b\nprint(5 - 2)  # \u5f15\u3044\u3066\u3044\u308b\nprint(10 \/ 2)   # \u5272\u3063\u3066\u3044\u308b\nprint(10 % 5)   # \u3042\u307e\u308a\u3092\u6c42\u3081\u3066\u3044\u308b\n\n# \u512a\u5148\u9806\u4f4d\u306e\u5909\u66f4\n# \u901a\u5e38\u306f +\u3068-\u3088\u308a\u3082*\u3084\/\u306e\u65b9\u304c\u512a\u5148\u5ea6\u304c\u9ad8\u3044\u3067\u3059\u304c\u3001()\u3067\u56f2\u3080\u3053\u3068\u3067\u512a\u5148\u5ea6\u3092\u5909\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\nprint((20 - 5) \/\/ 3)  # 5 \n\n<\/code><\/pre>\n<p>\u3067\u306f\u3001\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u4e0a\u304b\u3089\u9806\u306b\u3001<\/p>\n<pre><code class=\"shell:\">10\n15\n3\n5.0\n0\n<\/code><\/pre>\n<p>\u304c\u51fa\u529b\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u51fa\u6765\u308c\u3070\u5927\u4e08\u592b\u3067\u3059\u3002<br>\u6b21\u306b\u3001\u5272\u7b97\u306e\u51fa\u529b\u7d50\u679c\u304c\u5c0f\u6570\u70b9\u3068\u3044\u3046\u70b9\u306b\u95a2\u3057\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<br>Python2\u7cfb\u3067\u3042\u308c\u3070\u3001\u4f8b\u3048\u3070\u300110\/2\u306f5\u3068\u8a00\u3046\u7d50\u679c\u306b\u5bfe\u3057\u3066\u3001<br>3\u7cfb\u3067\u306f5.0\u3068\u306a\u308a\u307e\u3059\u3002<br>\u3053\u308c\u306f\u30012\u7cfb\u3067\u306f\u5207\u308a\u6368\u3066\u3066\u3044\u308b\u306e\u306b\u5bfe\u3057\u3066\u30013\u7cfb\u306f\u5207\u308a\u6368\u3066\u3066\u3044\u306a\u3044\u305f\u3081\u3067\u3059\u3002<br>3\u7cfb\u3067\u30012\u7cfb\u3068\u540c\u3058\u3088\u3046\u306b\u5207\u308a\u6368\u3066\u305f\u3044\u5834\u5408\u306f\u3001print(10\/\/2)\u3068\u3059\u308b\u3068\u51fa\u6765\u307e\u3059\u3002<\/p>\n<h2 id=\"i-7\">\u6587\u5b57\u5217\u3068\u6570\u5024\u306e\u9055\u3044<\/h2>\n<p>\u3055\u3066\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre><code>print(10 + 5)\nprint('10 + 5')\n<\/code><\/pre>\n<p>1\u884c\u76ee\u306eprint()\u3067\u306f\u300115\u304c\u51fa\u529b\u3055\u308c\u30012\u3067\u306f10 + 5\u304c\u51fa\u529b\u3055\u308c\u305f\u3067\u3057\u3087\u3046\u304b\uff1f<br>\u3053\u308c\u306f1\u3067\u306f\u6570\u5024\u306e\u8db3\u3057\u7b97\u306e\u7d50\u679c\u304c\u304b\u3048\u3063\u3066\u304d\u3066\u3044\u308b\u306e\u306b\u5bfe\u3057\u3066\u30012\u3067\u306f\u300c10 + 5\u300d\u3068\u3044\u3046\u6587\u5b57\u5217\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br>\u300c\u2019\u300d\u3084\u300c\u201d\u300d\u3067\u56f2\u3046\u3068\u3001\u6587\u5b57\u5217\u3068\u89e3\u91c8\u3055\u308c\u305d\u306e\u307e\u307e\u300c10 + 5\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3057\u305f\u3002<br>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067\u306f\u3001\u6587\u5b57\u5217\u3068\u6570\u5024\u306f\u5168\u304f\u7570\u306a\u308b\u3082\u306e\u3068\u3057\u3066\u6271\u308f\u308c\u307e\u3059\u3002<br>\u8a73\u3057\u304f\u306f\u6b21\u7ae0\u3001\u300c\u5909\u6570\u3068\u30c7\u30fc\u30bf\u578b\u300d\u3067\u8aac\u660e\u3057\u307e\u3059\u3002<br>\u3053\u3053\u3067\u306f\u3001<strong><em>\u6570\u5b57\u306b\u5bfe\u3057\u3066\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u53ca\u3073\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3080\u3068\u3001\u6587\u5b57\u5217\u3068\u3057\u3066\u6271\u308f\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u3092\u77e5\u3063\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/em><\/strong><\/p>\n<h2 id=\"i-8\">\u5909\u6570\u3068\u306f<\/h2>\n<p><strong>\u5909\u6570\u3068\u306f\u3001\u30c7\u30fc\u30bf\uff08\u5024\uff09\u3092\u5165\u308c\u3066\u304a\u304f\u7bb1\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3059\u3002<\/strong><br>\u5909\u6570\uff08\u7bb1\uff09\u306b\u306f\u5909\u6570\u540d\uff08\u540d\u524d\uff09\u3092\u81ea\u7531\u306b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u5024\u306f\u3001\u6570\u5024\u3067\u3082\u6587\u5b57\u5217\u3067\u3082\u5165\u308c\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<pre><code>name = \"Tom\" # \u6587\u5b57\u5217\u3002\u300c'\u300d\u3067\u56f2\u3063\u3066\u3082\u540c\u3058\u3067\u3059\u3002\nage = 24 # \u6570\u5024\n<\/code><\/pre>\n<p>\u3053\u3053\u3067\u300c=\u300d\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002<br>\u5909\u6570\u306f\u300c\u5909\u6570\u540d = \u5024\u300d\u3068\u3059\u308b\u3053\u3068\u3067\u5b9a\u7fa9\u51fa\u6765\u307e\u3059\u3002<br>\u5909\u6570\u540d\u306f\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u7b49\u3067\u56f2\u3080\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<br>\u307e\u305f\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u300c=\u300d\u306f\u7b49\u3057\u3044\u3068\u3044\u3046\u610f\u5473\u3067\u306f\u306a\u304f\u3001\u300c\u53f3\u8fba\u3092\uff08\u3053\u3053\u3067\u306fTom\u308424\uff09\u3001\u5de6\u8fba\u306b\u4ee3\u5165\u3059\u308b\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<br>\u3064\u307e\u308a\u3001\u300c=\u300d\u306f\u4ee3\u5165\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<br>\u3067\u306f\u5c11\u3057\u5fdc\u7528\u3067\u3059\u3002<br>print\u95a2\u6570\u3068\u5909\u6570\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u6b21\u306e\u3088\u3046\u306a\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>name = \"Tom\"\nprint(name) # \u5909\u6570name\u3092()\u306b\u5165\u308c\u308b\u3068\u3001\u300cTom\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002\n\nprint(\"name\") # \u300cname\u300d\u3068\u3044\u3046\u6587\u5b57\u5217\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002\n<\/code><\/pre>\n<p>\u3067\u306f\u3001\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>print(name)\u3068\u3059\u308b\u3068\u5909\u6570\u306b\u5165\u308c\u305f\u5024\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001<br>print(\u201cname\u201d)\u3068\u3057\u305f\u5834\u5408\uff08\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3063\u3066\u3044\u308b\u5834\u5408\uff09<br>\u5909\u6570name\u3067\u306f\u306a\u304f\u3001\u6587\u5b57\u5217\u3068\u3057\u3066\u8a8d\u8b58\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u5148\u307b\u3069\u3001\u5909\u6570\u306b\u306f\u81ea\u7531\u306b\u540d\u524d\u3092\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u8a00\u3044\u307e\u3057\u305f\u304c\u3001<br>\u5c11\u3057\u5b88\u308b\u30eb\u30fc\u30eb\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u3002<br>\u4f8b\u3048\u3070\u3001\u5909\u6570\u540d\u306e\u5148\u982d\u306f\u6570\u5b57\u3067\u66f8\u304f\u3053\u3068\u306f\u8a31\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<br>\u6570\u5b57\u3067\u66f8\u3044\u305f\u5834\u5408\u3001\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<br>\u307e\u305f\u3001\u300c\u6f22\u5b57\u300d\u3067\u5909\u6570\u3092\u5ba3\u8a00\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u307e\u3068\u3081\u308b\u3068\u3001<br>1. a\uff5ez\u306e\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8<br>2. \u6570\u5b57(\u5148\u982d\u4ee5\u5916)<br>3. _\uff08\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\uff09<\/p>\n<p>\u306e3\u7a2e\u985e\u306e\u6587\u5b57\u3060\u3051\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br><a href=\"http:\/\/www.lifewithpython.com\/2013\/02\/rules-for-naming-identifiers-in-python.html\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/www.lifewithpython.com\/2013\/02\/rules-for-naming-identifiers-in-python.html<\/a><\/p>\n<p>\u3067\u306f\u3001\u5909\u6570\u3092\u4f7f\u3046\u7406\u7531\u306f\u4f55\u3067\u3057\u3087\u3046\u304b\uff1f<br>\u5909\u6570\u3092\u4f7f\u308f\u306a\u304f\u3066\u3082\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067\u304d\u307e\u3059\u3002<br>\u3067\u3059\u304c\u3001\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u3068\u3057\u3066\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8aad\u3080\u6642\u306b\u305d\u306e\u30c7\u30fc\u30bf\u306e\u4e2d\u8eab\u304c\u4f55\u3092\u8868\u3057\u3066\u3044\u308b\u306e\u304b\u3001\u660e\u78ba\u306b\u306a\u308a\u30b3\u30fc\u30c9\u304c\u8aad\u307f\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<br>\u307e\u305f\u540c\u3058\u30c7\u30fc\u30bf\u3092\u7e70\u308a\u8fd4\u3057\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305f\u308a\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4fee\u6b63\u3059\u308b\u6642\u306b<br>\u5909\u66f4\u7b87\u6240\u304c1\u7b87\u6240\u3067\u6e08\u3093\u3060\u308a\u30e1\u30ea\u30c3\u30c8\u3070\u304b\u308a\u3067\u3059\u306e\u3067\u5909\u6570\u3092\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u5909\u6570\u306f\u5024\u3092\u66f4\u65b0\u3057\u4e0a\u66f8\u304d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>x = 10 # \u5909\u6570x\u3092\u5b9a\u7fa9\nprint(x) # 10\u304c\u51fa\u529b\n\nx = 20 # x\u306e\u5024\u309210\u304b\u308920\u306b\u4e0a\u66f8\u304d\u3002\nprint(x) # 20\u304c\u51fa\u529b\n<\/code><\/pre>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u4e0a\u304b\u3089\u4e0b\u307e\u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\u306e\u3067\u3001<br>\u6700\u521d\u3001\u5909\u6570x\u306b\u306f10\u304c\u4ee3\u5165\u3055\u308c\u307e\u3057\u305f\u304c\u3001\u9014\u4e2d\u306720\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067<br>\u4e0a\u66f8\u304d\u3055\u308c\u3066\u6700\u5f8c\u306e\u884c\u306eprint\u3067\u306f20\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5909\u6570\u306e\u4ee3\u5165\u306b\u306f\u3001\u7701\u7565\u7cfb\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code>x = x + 5 # x += 5\u3068\u540c\u3058\nx = x - 5 # x -= 5\u3068\u540c\u3058\nx = x * 5 # x *= 5\u3068\u540c\u3058\nx = x \/ 5 # x \/= 5\u3068\u540c\u3058\nx = x % 5 # x %= 5\u3068\u540c\u3058\n<\/code><\/pre>\n<h2 id=\"i-9\">\u6587\u5b57\u5217\u306e\u9023\u7d50<\/h2>\n<p>Python\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u4e16\u754c\u3067\u306f\u3001\u56db\u5247\u6f14\u7b97\u306e\u300c+\u300d\u306b\u3088\u308b\u8a08\u7b97\u4ee5\u5916\u306b\u3082\u3001\u6587\u5b57\u5217\u306e\u9023\u7d50\u3082\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u6587\u5b57\u5217\u306e\u9023\u7d50\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre><code>print(\"Hello\" + \"World\") # +\u306b\u3088\u308a\u6587\u5b57\u5217\u540c\u58eb\u3092\u9023\u7d50 HelloWorld\u306b\u306a\u308b\u3002\n\nname = \"Tom\"\nprint(\"My name is \" + name) # My name is Tom\u306b\u306a\u308b\u3002\n<\/code><\/pre>\n<h2 id=\"i-10\">\u307e\u3068\u3081<\/h2>\n<p>\u3053\u306e\u7ae0\u3067\u306fPython\u306e\u6700\u3082\u57fa\u672c\u7684\u306a\u6587\u6cd5\u3068\u7c21\u5358\u306b\u4e3b\u8981\u306a\u30c7\u30fc\u30bf\u578b(\u3053\u3053\u3067\u306f\u6574\u6570\u578b\u3068\u6587\u5b57\u5217\u578b\uff09\u306b\u95a2\u3057\u3066\u5b66\u3073\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u89e6\u308c\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/aiacademy.jp\/bootcamp\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-1024x341.png\" alt=\"\" class=\"wp-image-691\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-1024x341.png 1024w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-300x100.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-768x256.png 768w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-940x313.png 940w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\"><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21 \u306f\u3058\u3081\u306b Python\u3068\u306f Python2\u7cfb\u30683\u7cfb\u306e\u9055\u3044 PEP8 \u6587\u5b57\u5217\u3068\u306f \u30b3\u30e1\u30f3\u30c8 \u6570\u5024 \u6587\u5b57\u5217\u3068\u6570\u5024\u306e\u9055\u3044 \u5909\u6570\u3068\u306f \u6587\u5b57\u5217\u306e\u9023\u7d50 \u307e\u3068\u3081 \u306f\u3058\u3081\u306b \u3053\u306e\u7ae0\u304b\u3089\u3001\u5b9f\u969b\u306bPython\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u3044\u304d &#8230; <\/p>\n","protected":false},"author":1,"featured_media":2171,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85],"tags":[],"class_list":{"0":"post-119","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"_links":{"self":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=119"}],"version-history":[{"count":9,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":4848,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions\/4848"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/media\/2171"}],"wp:attachment":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}