Book2 3 of 5

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 37

<!

doctype html>
<html
lang="en"
dir="ltr">
<head>
<meta name="google-signin-client-id" content="721724668570-
nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com">
<meta name="google-signin-scope"
content="profile email https://www.googleapis.com/auth/developerprofiles
https://www.googleapis.com/auth/developerprofiles.award">
<meta property="og:site_name" content="Google Developers">
<meta property="og:type" content="website"><meta name="theme-color"
content="#12b5cb"><meta charset="utf-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="/_pwa/developers/manifest.json"
crossorigin="use-credentials">
<link rel="preconnect" href="//www.gstatic.com" crossorigin>
<link rel="preconnect" href="//fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="//fonts.googleapis.com" crossorigin>
<link rel="preconnect" href="//apis.google.com" crossorigin>
<link rel="preconnect" href="//www.google-analytics.com" crossorigin><link
rel="stylesheet" href="//fonts.googleapis.com/css?family=Google+Sans:400,500|
Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700|
Material+Icons&display=swap"><link rel="stylesheet"
href="https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers/css/app.css"><link rel="shortcut icon" href="https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers/images/favicon.png">
<link rel="apple-touch-icon" href="https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers/images/touchicon-180.png"><link rel="canonical"
href="https://developers.google.com/edu/python/introduction"><link rel="search"
type="application/opensearchdescription+xml"
title="Google Developers"
href="https://developers.google.com/s/opensearch.xml">

<title>Python Introduction &nbsp;|&nbsp; Python Education &nbsp;|&nbsp; Google


Developers</title>

<meta property="og:title" content="Python Introduction &nbsp;|&nbsp; Python


Education &nbsp;|&nbsp; Google Developers"><meta property="og:url"
content="https://developers.google.com/edu/python/introduction"><meta
property="og:image" content="https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers/images/opengraph/cyan.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="675"><meta property="og:locale"
content="en"><meta name="twitter:card" content="summary_large_image"><script
type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Google for Education",
"item": "https://developers.google.com/edu"
},{
"@type": "ListItem",
"position": 2,
"name": "Python",
"item": "https://developers.google.com/edu/python"
},{
"@type": "ListItem",
"position": 3,
"name": "Python Introduction",
"item": "https://developers.google.com/edu/python/introduction"
}]
}
</script>
<meta name="xsrf_token" content="QZyBImKP9YHUN-
oZNTr0sO9eVJ8M9CjXDfxnzOBWTdI6MTYyMTc2NTAyNjMwNzM5NA">

<meta name="session_expiry" content="0">

</head>
<body class=""
template="page"
theme="cyan"
type="article"

layout="docs"

pending>
<devsite-progress type="indeterminate" id="app-progress"></devsite-progress>

<section class="devsite-wrapper"><devsite-header>
<div class="devsite-header--inner nocontent">
<div class="devsite-top-logo-row-wrapper-wrapper">
<div class="devsite-top-logo-row-wrapper">
<div class="devsite-top-logo-row">
<button type="button" id="devsite-hamburger-menu"
class="devsite-header-icon-button button-flat material-icons gc-
analytics-event"
data-category="Site-Wide Custom Events"
data-label="Navigation menu button"
visually-hidden
aria-label="Open menu">
</button>
<div class="devsite-product-name-wrapper">

<span class="devsite-product-name">
<ul class="devsite-breadcrumb-list"

aria-label="Product breadcrumb">

<li class="devsite-breadcrumb-item
devsite-has-google-wordmark">

<a href="https://developers.google.com/edu"

class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Upper Header"

data-value="1"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="1"
track-metadata-eventdetail="Google for Education"

>

<svg class="devsite-google-wordmark"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 148 48">
<title>Google</title>
<path class="devsite-google-wordmark-svg-path" d="M19.58,37.65c-9.87,0-18.17-
8.04-18.17-17.91c0-9.87,8.3-17.91,18.17-17.91c5.46,0,9.35,2.14,12.27,4.94l-
3.45,3.45c-2.1-1.97-4.93-3.49-8.82-3.49c-7.21,0-12.84,5.81-
12.84,13.02c0,7.21,5.64,13.02,12.84,13.02c4.67,0,7.34-1.88,9.04-3.58c1.4-1.4,2.32-
3.41,2.66-6.16H19.58v-4.89h16.47c0.18,0.87,0.26,1.92,0.26,3.06c0,3.67-1.01,8.21-
4.24,11.44C28.93,35.9,24.91,37.65,19.58,37.65z M61.78,26.12c0,6.64-5.1,11.53-
11.36,11.53s-11.36-4.89-11.36-11.53c0-6.68,5.1-11.53,11.36-
11.53S61.78,19.43,61.78,26.12z M56.8,26.12c0-4.15-2.96-6.99-6.39-6.99c-3.43,0-
6.39,2.84-6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C53.84,33.11,56.8,30.22,56.8,26.12z
M87.25,26.12c0,6.64-5.1,11.53-11.36,11.53c-6.26,0-11.36-4.89-11.36-11.53c0-
6.68,5.1-11.53,11.36-11.53C82.15,14.59,87.25,19.43,87.25,26.12zM82.28,26.12c0-4.15-
2.96-6.99-6.39-6.99c-3.43,0-6.39,2.84-
6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C79.32,33.11,82.28,30.22,82.28,26.12z
M112.09,15.29v20.7c0,8.52-5.02,12.01-10.96,12.01c-5.59,0-8.95-3.76-10.22-6.81l4.41-
1.83c0.79,1.88,2.71,4.1,5.81,4.1c3.8,0,6.16-2.36,6.16-6.77v-1.66h-0.18c-1.14,1.4-
3.32,2.62-6.07,2.62c-5.76,0-11.05-5.02-11.05-11.49c0-6.51,5.28-11.57,11.05-
11.57c2.75,0,4.93,1.22,6.07,2.58h0.18v-1.88H112.09z M107.64,26.16c0-4.06-2.71-7.03-
6.16-7.03c-3.49,0-6.42,2.97-
6.42,7.03c0,4.02,2.93,6.94,6.42,6.94C104.93,33.11,107.64,30.18,107.64,26.16z
M120.97,3.06v33.89h-5.07V3.06H120.97z M140.89,29.92l3.93,2.62c-1.27,1.88-4.32,5.11-
9.61,5.11c-6.55,0-11.28-5.07-11.28-11.53c0-6.86,4.77-11.53,10.71-
11.53c5.98,0,8.91,4.76,9.87,7.34l0.52,1.31l-
15.42,6.38c1.18,2.31,3.01,3.49,5.59,3.49C137.79,33.11,139.58,31.84,140.89,29.92zM12
8.79,25.77l10.31-4.28c-0.57-1.44-2.27-2.45-4.28-
2.45C132.24,19.04,128.66,21.31,128.79,25.77z"/>
</svg>for Education

</a>

</li>

<li class="devsite-breadcrumb-item
">

<div class="devsite-breadcrumb-guillemet material-icons" aria-


hidden="true"></div>

<a href="https://developers.google.com/edu/python"

class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Upper Header"
data-value="2"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="2"

track-metadata-eventdetail="Python Education from Google"

>

Python

</a>

</li>

</ul>
</span>

</div>
<div class="devsite-top-logo-row-middle">
<div class="devsite-header-upper-tabs">

</div>

<devsite-search
aria-expanded="false"
aria-haspopup="listbox"
enable-signin
enable-search
enable-suggestions
enable-query-completion

project-name="Python Education"
tenant-name="Google Developers"
project-scope="/edu/python"
url-scoped="https://developers.google.com/s/results/edu/python"

role="combobox">
<form class="devsite-search-form"
action="https://developers.google.com/s/results" method="GET">
<div class="devsite-search-container">
<div class="devsite-searchbox">
<input
aria-activedescendant=""
aria-autocomplete="list"

aria-label="Search"
aria-haspopup="false"
aria-multiline="false"
aria-label="Search box"
autocomplete="off"
class="devsite-search-field devsite-search-query"
name="q"

placeholder="Search"
role="combobox"
type="text"
value=""
>
<div class="devsite-search-image material-icons" aria-hidden="true"></div>
</div>
<button type="button"
search-open
class="devsite-search-button devsite-header-icon-button button-flat
material-icons"

aria-label="Open search"></button>
</div>
</form>
<button type="button"
search-close
class="devsite-search-button devsite-header-icon-button button-flat
material-icons"

aria-label="Close search"></button>
</devsite-search>

</div>

<devsite-language-selector>
<devsite-select class="devsite-language-selector-menu">

<select aria-label="Select your language preference."


class="devsite-language-selector-select"
name="language"
track-name="click"
track-type="languageSelector">

<option>Language</option>

<option value="en"
lang="en"
track-metadata-original-language="en"
track-metadata-selected-language="en"
track-name="changed"
track-type="languageSelector"
>
English
</option>

<option value="id"
lang="id"
track-metadata-original-language="en"
track-metadata-selected-language="id"
track-name="changed"
track-type="languageSelector"
>
Bahasa Indonesia
</option>

<option value="de"
lang="de"
track-metadata-original-language="en"
track-metadata-selected-language="de"
track-name="changed"
track-type="languageSelector"
>
Deutsch
</option>

<option value="es"
lang="es"
track-metadata-original-language="en"
track-metadata-selected-language="es"
track-name="changed"
track-type="languageSelector"
>
Español
</option>

<option value="fr"
lang="fr"
track-metadata-original-language="en"
track-metadata-selected-language="fr"
track-name="changed"
track-type="languageSelector"
>
Français
</option>

<option value="pt_br"
lang="pt_br"
track-metadata-original-language="en"
track-metadata-selected-language="pt_br"
track-name="changed"
track-type="languageSelector"
>
Português – Brasil
</option>

<option value="ru"
lang="ru"
track-metadata-original-language="en"
track-metadata-selected-language="ru"
track-name="changed"
track-type="languageSelector"
>
Русский
</option>

<option value="zh_cn"
lang="zh_cn"
track-metadata-original-language="en"
track-metadata-selected-language="zh_cn"
track-name="changed"
track-type="languageSelector"
>
中文 – 简体
</option>

<option value="ja"
lang="ja"
track-metadata-original-language="en"
track-metadata-selected-language="ja"
track-name="changed"
track-type="languageSelector"
>
日本語
</option>

<option value="ko"
lang="ko"
track-metadata-original-language="en"
track-metadata-selected-language="ko"
track-name="changed"
track-type="languageSelector"
>
한국어
</option>

</select>
</devsite-select>
</devsite-language-selector>

<devsite-user signed-in

enable-profiles

fp-auth

id="devsite-user"></devsite-user>

</div>
</div>
</div>

<div class="devsite-collapsible-section

devsite-header-no-lower-tabs
">
<div class="devsite-header-background">

</div>
</div>

</div>

</devsite-header>
<devsite-book-nav scrollbars >

<nav class="devsite-book-nav devsite-nav nocontent"


aria-label="Side menu">
<div class="devsite-mobile-header">
<button type="button"
id="devsite-close-nav"
class="devsite-header-icon-button button-flat material-icons gc-
analytics-event"
data-category="Site-Wide Custom Events"
data-label="Close navigation"
aria-label="Close navigation">
</button>
<div class="devsite-product-name-wrapper">
<span class="devsite-product-name">

<ul class="devsite-breadcrumb-list"

aria-label="Upper header breadcrumb">

<li class="devsite-breadcrumb-item
devsite-has-google-wordmark">

<a href="https://developers.google.com/edu"

class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Upper Header"

data-value="1"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="1"

track-metadata-eventdetail="Google for Education"

>

<svg class="devsite-google-wordmark"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 148 48">
<title>Google</title>
<path class="devsite-google-wordmark-svg-path" d="M19.58,37.65c-9.87,0-18.17-
8.04-18.17-17.91c0-9.87,8.3-17.91,18.17-17.91c5.46,0,9.35,2.14,12.27,4.94l-
3.45,3.45c-2.1-1.97-4.93-3.49-8.82-3.49c-7.21,0-12.84,5.81-
12.84,13.02c0,7.21,5.64,13.02,12.84,13.02c4.67,0,7.34-1.88,9.04-3.58c1.4-1.4,2.32-
3.41,2.66-6.16H19.58v-4.89h16.47c0.18,0.87,0.26,1.92,0.26,3.06c0,3.67-1.01,8.21-
4.24,11.44C28.93,35.9,24.91,37.65,19.58,37.65z M61.78,26.12c0,6.64-5.1,11.53-
11.36,11.53s-11.36-4.89-11.36-11.53c0-6.68,5.1-11.53,11.36-
11.53S61.78,19.43,61.78,26.12z M56.8,26.12c0-4.15-2.96-6.99-6.39-6.99c-3.43,0-
6.39,2.84-6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C53.84,33.11,56.8,30.22,56.8,26.12z
M87.25,26.12c0,6.64-5.1,11.53-11.36,11.53c-6.26,0-11.36-4.89-11.36-11.53c0-
6.68,5.1-11.53,11.36-11.53C82.15,14.59,87.25,19.43,87.25,26.12zM82.28,26.12c0-4.15-
2.96-6.99-6.39-6.99c-3.43,0-6.39,2.84-
6.39,6.99c0,4.11,2.96,6.99,6.39,6.99C79.32,33.11,82.28,30.22,82.28,26.12z
M112.09,15.29v20.7c0,8.52-5.02,12.01-10.96,12.01c-5.59,0-8.95-3.76-10.22-6.81l4.41-
1.83c0.79,1.88,2.71,4.1,5.81,4.1c3.8,0,6.16-2.36,6.16-6.77v-1.66h-0.18c-1.14,1.4-
3.32,2.62-6.07,2.62c-5.76,0-11.05-5.02-11.05-11.49c0-6.51,5.28-11.57,11.05-
11.57c2.75,0,4.93,1.22,6.07,2.58h0.18v-1.88H112.09z M107.64,26.16c0-4.06-2.71-7.03-
6.16-7.03c-3.49,0-6.42,2.97-
6.42,7.03c0,4.02,2.93,6.94,6.42,6.94C104.93,33.11,107.64,30.18,107.64,26.16z
M120.97,3.06v33.89h-5.07V3.06H120.97z M140.89,29.92l3.93,2.62c-1.27,1.88-4.32,5.11-
9.61,5.11c-6.55,0-11.28-5.07-11.28-11.53c0-6.86,4.77-11.53,10.71-
11.53c5.98,0,8.91,4.76,9.87,7.34l0.52,1.31l-
15.42,6.38c1.18,2.31,3.01,3.49,5.59,3.49C137.79,33.11,139.58,31.84,140.89,29.92zM12
8.79,25.77l10.31-4.28c-0.57-1.44-2.27-2.45-4.28-
2.45C132.24,19.04,128.66,21.31,128.79,25.77z"/>
</svg>for Education

</a>

</li>

<li class="devsite-breadcrumb-item
">

<div class="devsite-breadcrumb-guillemet material-icons" aria-


hidden="true"></div>

<a href="https://developers.google.com/edu/python"

class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Upper Header"

data-value="2"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="2"

track-metadata-eventdetail="Python Education from Google"

>

Python

</a>

</li>

</ul>
</span>

</div>
</div>

<div class="devsite-book-nav-wrapper">
<div class="devsite-mobile-nav-top">

<ul class="devsite-nav-list">

<li class="devsite-nav-item">

<a href="/edu/python"

class="devsite-nav-title gc-analytics-event
devsite-nav-has-children
devsite-nav-active"

data-category="Site-Wide Custom Events"


data-label="Responsive Tab: Guides"
track-type="navMenu"
track-metadata-eventDetail="globalMenu"
track-metadata-position="nav"
track-name="guides">

<span class="devsite-nav-text" tooltip >


Guides
</span>

<span class="devsite-nav-icon material-icons" data-icon="forward"


>
</span>

</a>

</li>

</ul>

</div>

<div class="devsite-mobile-nav-bottom" role="navigation">

<ul class="devsite-nav-list" menu="_book">


<li class="devsite-nav-item"><a href="/edu/python"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Overview</span></a></li>

<li class="devsite-nav-item"><a href="/edu/python/set-up"


class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Python Set Up</span></a></li>

<li class="devsite-nav-item"><a href="/edu/python/introduction"


class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Python Intro</span></a></li>
<li class="devsite-nav-item"><a href="/edu/python/strings"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Strings</span></a></li>

<li class="devsite-nav-item"><a href="/edu/python/lists"


class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Lists</span></a></li>

<li class="devsite-nav-item"><a href="/edu/python/sorting"


class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Sorting</span></a></li>

<li class="devsite-nav-item"><a href="/edu/python/dict-files"


class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Dicts and Files</span></a></li>

<li class="devsite-nav-item"><a href="/edu/python/regular-expressions"


class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Regular Expressions</span></a></li>

<li class="devsite-nav-item"><a href="/edu/python/utilities"


class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Utilities</span></a></li>

<li class="devsite-nav-item
devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-
path"><span class="devsite-nav-text" tooltip>Lecture Videos</span></div><ul
class="devsite-nav-section"><li class="devsite-nav-item
devsite-nav-external"><a href="http://www.youtube.com/watch?
v=tKTZoB2Vjuk"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>1.1 Introduction, strings</span><span
class="devsite-nav-icon material-icons"
data-icon="external"
data-title="External"
aria-hidden="true"></span></a></li><li class="devsite-nav-item
devsite-nav-external"><a href="http://www.youtube.com/watch?
v=EPYupizJYQI"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>1.2 Lists and sorting</span><span
class="devsite-nav-icon material-icons"
data-icon="external"
data-title="External"
aria-hidden="true"></span></a></li><li class="devsite-nav-item
devsite-nav-external"><a href="http://www.youtube.com/watch?
v=haycL41dAhg"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>1.3 Dicts and files</span><span
class="devsite-nav-icon material-icons"
data-icon="external"
data-title="External"
aria-hidden="true"></span></a></li><li class="devsite-nav-item
devsite-nav-external"><a href="http://www.youtube.com/watch?
v=kWyoYtvJpe4"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>2.1 Regular expr</span><span
class="devsite-nav-icon material-icons"
data-icon="external"
data-title="External"
aria-hidden="true"></span></a></li><li class="devsite-nav-item
devsite-nav-external"><a href="http://www.youtube.com/watch?
v=uKZ8GBKmeDM"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>2.2 Utilities</span><span
class="devsite-nav-icon material-icons"
data-icon="external"
data-title="External"
aria-hidden="true"></span></a></li><li class="devsite-nav-item
devsite-nav-external"><a href="http://www.youtube.com/watch?
v=Nn2KQmVF5Og"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>2.3 Utilities urllib</span><span
class="devsite-nav-icon material-icons"
data-icon="external"
data-title="External"
aria-hidden="true"></span></a></li><li class="devsite-nav-item
devsite-nav-external"><a href="http://www.youtube.com/watch?
v=IcteAbMC1Ok"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>2.4 Conclusions</span><span
class="devsite-nav-icon material-icons"
data-icon="external"
data-title="External"
aria-hidden="true"></span></a></li></ul></li>

<li class="devsite-nav-item
devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-
path"><span class="devsite-nav-text" tooltip>Python Exercises</span></div><ul
class="devsite-nav-section"><li class="devsite-nav-item"><a
href="/edu/python/exercises/basic"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Basic Exercises</span></a></li><li
class="devsite-nav-item"><a href="/edu/python/exercises/baby-names"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Baby Names Exercise</span></a></li><li
class="devsite-nav-item"><a href="/edu/python/exercises/copy-special"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Copy Special Exercise</span></a></li><li
class="devsite-nav-item"><a href="/edu/python/exercises/log-puzzle"
class="devsite-nav-title"
><span class="devsite-nav-text" tooltip>Log Puzzle
Exercise</span></a></li></ul></li>
</ul>

</div>

</div>
</nav>

</devsite-book-nav>
<section id="gc-wrapper">
<main role="main" class="devsite-main-content"
has-book-nav
has-toc>
<devsite-toc class="devsite-nav"
></devsite-toc>
<devsite-content>

<article class="devsite-article">

<div class="devsite-article-meta nocontent" role="navigation">

<ul class="devsite-breadcrumb-list"

aria-label="Breadcrumb">

<li class="devsite-breadcrumb-item
">

<a href="https://developers.google.com/"

class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Breadcrumbs"

data-value="1"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="1"
track-metadata-eventdetail=""

>

Home

</a>

</li>

<li class="devsite-breadcrumb-item
">

<div class="devsite-breadcrumb-guillemet material-icons" aria-


hidden="true"></div>

<a href="https://developers.google.com/products"

class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Breadcrumbs"

data-value="2"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="2"

track-metadata-eventdetail=""

>

Products

</a>

</li>

<li class="devsite-breadcrumb-item
">

<div class="devsite-breadcrumb-guillemet material-icons" aria-


hidden="true"></div>

<a href="https://developers.google.com/edu"
class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Breadcrumbs"

data-value="3"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="3"

track-metadata-eventdetail="Google for Education"

>

Google for Education

</a>

</li>

<li class="devsite-breadcrumb-item
">

<div class="devsite-breadcrumb-guillemet material-icons" aria-


hidden="true"></div>

<a href="https://developers.google.com/edu/python"

class="devsite-breadcrumb-link gc-analytics-event"

data-category="Site-Wide Custom Events"

data-label="Breadcrumbs"

data-value="4"

track-type="globalNav"

track-name="breadcrumb"

track-metadata-position="4"

track-metadata-eventdetail="Python Education from Google"

>

Python

</a>
</li>

</ul>

<devsite-thumb-rating position="header">
<template class="thumb-down-categories">
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples/Code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
</template>
<template class="thumb-up-categories">
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
</template>

</devsite-thumb-rating>

</div>

<h1 class="devsite-page-title">Python Introduction<devsite-bookmark></devsite-


bookmark></h1>

<devsite-toc class="devsite-nav" devsite-toc-embedded


>
</devsite-toc>

<div class="devsite-article-body clearfix


">

<h2 id="prelude" data-text="Prelude">Prelude</h2>

<p>Welcome to Google's Python online tutorial. It is based on the introductory


Python course offered internally. Originally created during the Python 2.4 days,
we've tried to keep the content universal and exercises relevant, even for newer
releases. As mentioned on the <a href="/edu/python/set-up">setup page</a>, this
material covers Python 2. This course material was created for Python 2 and has not
yet been updated for modern Python 3. The good news is that developers learning
either version can pick up the other without too much difficulty. If you want to
know more about choosing Python 2 vs. 3, check out <a
href="http://qr.ae/36Yaz">this post</a>.</p>

<p>We strongly recommend you follow along with the companion videos throughout the
course, starting with <a href="http://youtu.be/tKTZoB2Vjuk">the first one</a>. If
you're seeking a companion MOOC course, try the ones from <a
href="http://udacity.com/course/cs101">Udacity</a> and Coursera (<a
href="http://coursera.org/course/programming1">intro to programming</a> [beginners]
or <a href="http://coursera.org/course/interactivepython">intro to Python</a>), and
if you're looking for a companion book to your learning, regardless of your Python
skill level, check out <a href="http://goo.gl/i4u0R">these reading lists</a>.
Finally, if you're seeking self-paced online learning <i>without</i> watching
videos, try the ones listed towards the end of <a
href="http://stackoverflow.com/a/3226704/305689">this post</a> &mdash; each feature
learning content as well as a Python interactive interpreter you can practice with.
What's this "interpreter" we mention? You'll find out in the next section!</p>

<h2 id="language-introduction" data-text="Language Introduction">Language


Introduction</h2>

<p>Python is a dynamic, interpreted (bytecode-compiled) language. There are no type


declarations of variables, parameters, functions, or methods in source code. This
makes the code short and flexible, and you lose the compile-time type checking of
the source code. Python tracks the types of all values at runtime and flags code
that does not make sense as it runs.

<p>An excellent way to see how Python code works is to run the Python interpreter
and type code right into it. If you ever have a question like, "What happens if I
add an <code translate="no" dir="ltr">int</code> to a <code translate="no"
dir="ltr">list</code>?" Just typing it into the Python interpreter is a fast and
likely the best way to see what happens. (See below to see what really
happens!)</p>

<pre class='prettyprint' translate="no" dir="ltr">


$ python ## Run the Python interpreter
Python 2.7.9 (default, Dec 30 2014, 03:41:42)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 6 ## set a variable in this interpreter session
>>> a ## entering an expression prints its value
6
>>> a + 2
8
>>> a = 'hi' ## 'a' can hold a string just as well
>>> a
'hi'
>>> len(a) ## call the len() function on a string
2
>>> a + len(a) ## try something that doesn't work
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'int' objects
>>> a + str(len(a)) ## probably what you really wanted
'hi2'
>>> foo ## try something else that doesn't work
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>> ^D ## type CTRL-d to exit (CTRL-z in Windows/DOS terminal)
</pre>

<p>As you can see above, it's easy to experiment with variables and operators.
Also, the interpreter throws, or "raises" in Python parlance, a runtime error if
the code tries to read a variable that has not been assigned a value. Like C++ and
Java, Python is case sensitive so "a" and "A" are different variables. The end of a
line marks the end of a statement, so unlike C++ and Java, Python does not require
a semicolon at the end of each statement. Comments begin with a '#' and extend to
the end of the line.</p>

<h2 id="python-source-code" data-text="Python source code">Python source code</h2>

<p>Python source files use the ".py" extension and are called "modules." With a
Python module <code translate="no" dir="ltr">hello.py</code>, the easiest way to
run it is with the shell command "python hello.py Alice" which calls the Python
interpreter to execute the code in <code translate="no" dir="ltr">hello.py</code>,
passing it the command line argument "Alice".
See the <a href="http://docs.python.org/using/cmdline">official docs page</a> on
all the different options you have when running Python from the command-line.
</p>

<p>Here's a very simple <code translate="no" dir="ltr">hello.py</code> program


(notice that blocks of code are delimited strictly using indentation rather than
curly braces &mdash; more on this later!):</p>

<pre class='prettyprint' translate="no" dir="ltr">


#!/usr/bin/env python

# import modules used here -- sys is a very standard one


import sys

# Gather our code in a main() function


def main():
print 'Hello there', sys.argv[1]
# Command line args are in sys.argv[1], sys.argv[2] ...
# sys.argv[0] is the script name itself and can be ignored

# Standard boilerplate to call the main() function to begin


# the program.
if __name__ == '__main__':
main()
</pre>

<p>Running this program from the command line looks like:</p>


<pre translate="no" dir="ltr">
$ python hello.py Guido
Hello there Guido
$ ./hello.py Alice ## without needing 'python' first (Unix)
Hello there Alice
</pre>

<h2 id="imports,-command-line-arguments,-and-len" data-text="Imports, Command-line


arguments, and len()">Imports, Command-line arguments, and <code translate="no"
dir="ltr">len()</code></h2>

<p>The outermost statements in a Python file, or "module", do its one-time setup


&mdash; those statements run from top to bottom the first time the module is
imported somewhere, setting up its variables and functions. A Python module can be
run directly &mdash; as above "python hello.py Bob" &mdash; or it can be imported
and used by some other module. When a Python file is run directly, the special
variable "__name__" is set to "__main__". Therefore, it's common to have the
boilerplate <code translate="no" dir="ltr">if __name__ ==...</code> shown above to
call a main() function when the module is run directly, but not when the module is
imported by some other module.</p>

<p>In a standard Python program, the list <code translate="no"


dir="ltr">sys.argv</code> contains the command-line arguments in the standard way
with sys.argv[0] being the program itself, sys.argv[1] the first argument, and so
on. If you know about <code translate="no" dir="ltr">argc</code>, or the number of
arguments, you can simply request this value from Python with <code translate="no"
dir="ltr">len(sys.argv)</code>, just like we did in the interactive interpreter
code above when requesting the length of a string. In general, <code translate="no"
dir="ltr">len()</code> can tell you how long a string is, the number of elements in
lists and tuples (another array-like data structure), and the number of key-value
pairs in a dictionary.</p>

<h2 id="user-defined-functions" data-text="User-defined Functions">User-defined


Functions</h2>

<p>Functions in Python are defined like this:</p>

<pre class='prettyprint' translate="no" dir="ltr">


# Defines a "repeat" function that takes 2 arguments.
def repeat(s, exclaim):
"""
Returns the string 's' repeated 3 times.
If exclaim is true, add exclamation marks.
"""

result = s + s + s # can also use "s * 3" which is faster (Why?)


if exclaim:
result = result + '!!!'
return result
</pre>

<p>Notice also how the lines that make up the function or if-statement are grouped
by all having the same level of indentation. We also presented 2 different ways to
repeat strings, using the + operator which is more user-friendly, but * also works
because it's Python's "repeat" operator, meaning that <code translate="no"
dir="ltr">'-' * 10</code> gives <code translate="no" dir="ltr">'----------'</code>,
a neat way to create an onscreen "line." In the code comment, we hinted that *
works faster than +, the reason being that * calculates the size of the resulting
object once whereas with +, that calculation is made each time + is called. Both +
and * are called "overloaded" operators because they mean different things for
numbers vs. for strings (and other data types).</p>

<p>The <code translate="no" dir="ltr">def</code> keyword defines the function with


its parameters within parentheses and its code indented. The first line of a
function can be a documentation string ("docstring") that describes what the
function does. The docstring can be a single line, or a multi-line description as
in the example above. (Yes, those are "triple quotes," a feature unique to Python!)
Variables defined in the function are local to that function, so the "result" in
the above function is separate from a "result" variable in another function. The
<code translate="no" dir="ltr">return</code> statement can take an argument, in
which case that is the value returned to the caller.</p>

<p>Here is code that calls the above repeat() function, printing what it
returns:</p>

<pre class='prettyprint' translate="no" dir="ltr">


def main():
print repeat('Yay', False) ## YayYayYay
print repeat('Woo Hoo', True) ## Woo HooWoo HooWoo Hoo!!!
</pre>

<p>At run time, functions must be defined by the execution of a "def" before they
are called. It's typical to def a main() function towards the bottom of the file
with the functions it calls above it.</p>

<h2 id="indentation" data-text="Indentation">Indentation</h2>

<p>One unusual Python feature is that the whitespace indentation of a piece of code
affects its meaning. A logical block of statements such as the ones that make up a
function should all have the same indentation, set in from the indentation of their
parent function or "if" or whatever. If one of the lines in a group has a different
indentation, it is flagged as a syntax error.</p>

<p>Python's use of whitespace feels a little strange at first, but it's logical and
I found I got used to it very quickly. Avoid using TABs as they greatly complicate
the indentation scheme (not to mention TABs may mean different things on different
platforms). Set your editor to insert spaces instead of TABs for Python code.</p>

<p>A common question beginners ask is, "How many spaces should I indent?" According
to <a href="http://python.org/dev/peps/pep-0008/#indentation">the official Python
style guide (PEP 8)</a>, you should indent with 4 spaces. (Fun fact: Google's
internal style guideline dictates indenting by 2 spaces!)</p>

<h2 id="code-checked-at-runtime" data-text="Code Checked at Runtime">Code Checked


at Runtime</h2>

<p>Python does very little checking at compile time, deferring almost all type,
name, etc. checks on each line until that line runs. Suppose the above main() calls
repeat() like this:</p>

<pre class='prettyprint' translate="no" dir="ltr">


def main():
if name == 'Guido':
print repeeeet(name) + '!!!'
else:
print repeat(name)
</pre>

<p>The if-statement contains an obvious error, where the repeat() function is


accidentally typed in as repeeeet(). The funny thing in Python ... this code
compiles and runs fine so long as the name at runtime is not 'Guido'. Only when a
run actually tries to execute the repeeeet() will it notice that there is no such
function and raise an error. This just means that when you first run a Python
program, some of the first errors you see will be simple typos like this. This is
one area where languages with a more verbose type system, like Java, have an
advantage ... they can catch such errors at compile time (but of course you have to
maintain all that type information ... it's a tradeoff).</p>

<h2 id="variable-names" data-text="Variable Names">Variable Names</h2>

<p>Since Python variables don't have any type spelled out in the source code, it's
extra helpful to give meaningful names to your variables to remind yourself of
what's going on. So use "name" if it's a single name, and "names" if it's a list of
names, and "tuples" if it's a list of tuples. <!-- may link to list/tuple docs here
--> Many basic Python errors result from forgetting what type of value is in each
variable, so use your variable names (all you have really) to help keep things
straight.</p>

<p>As far as actual naming goes, some languages prefer underscored_parts for
variable names made up of "more than one word," but other languages prefer
camelCasing. In general, Python <a href="http://python.org/dev/peps/pep-
0008/#function-names">prefers</a> the underscore method but guides developers to
defer to camelCasing if integrating into existing Python code that already uses
that style. Readability counts. Read more in <a
href="https://www.python.org/dev/peps/pep-0008/#naming-conventions">the section on
naming conventions in PEP 8</a>.</p>

<p>As you can guess, keywords like 'print' and 'while' cannot be used as variable
names &mdash; you'll get a syntax error if you do. However, be careful not to use
built-ins as variable names. For example, while 'str' and 'list' may seem like good
names, you'd be overriding those system variables. Built-ins are not keywords and
thus, are susceptible to inadvertent use by new Python developers.</p>

<h2 id="more-on-modules-and-their-namespaces" data-text="More on Modules and their


Namespaces">More on Modules and their Namespaces</h2>

<p>Suppose you've got a module "binky.py" which contains a "def foo()". The fully
qualified name of that foo function is "binky.foo". In this way, various Python
modules can name their functions and variables whatever they want, and the variable
names won't conflict &mdash; module1.foo is different from module2.foo. In the
Python vocabulary, we'd say that binky, module1, and module2 each have their own
"namespaces," which as you can guess are variable name-to-object bindings.</p>

<p>For example, we have the standard "sys" module that contains some standard
system facilities, like the argv list, and exit() function. With the statement
"import sys" you can then access the definitions in the sys module and make them
available by their fully-qualified name, e.g. sys.exit(). (Yes, 'sys' has a
namespace too!)</p>

<pre class='prettyprint' translate="no" dir="ltr">


import sys
# Now can refer to sys.xxx facilities
sys.exit(0)
</pre>

<p>There is another import form that looks like this: "from sys import argv, exit".
That makes argv and exit() available by their short names; however, we recommend
the original form with the fully-qualified names because it's a lot easier to
determine where a function or attribute came from.</p>

<p>There are many modules and packages which are bundled with a standard
installation of the Python interpreter, so you don't have to do anything extra to
use them. These are collectively known as the "Python Standard Library." Commonly
used modules/packages include:</p>

<ul>
<li> sys &mdash; access to exit(), argv, stdin, stdout, ...

<li> re &mdash; regular expressions

<li> os &mdash; operating system interface, file system


</ul>

<p>You can find the documentation of all the Standard Library modules and packages
at <a href="http://docs.python.org/library">http://docs.python.org/library</a>.</p>

<!-- could link to modules materials -->

<h2 id="online-help,-help,-and-dir" data-text="Online help, help(), and


dir()">Online help, <code translate="no" dir="ltr">help()</code>, and <code
translate="no" dir="ltr">dir()</code></h2>

<p>There are a variety of ways to get help for Python.</p>

<ul>
<li>Do a Google search, starting with the word "python", like "python list" or
"python string lowercase". The first hit is often the answer. This technique seems
to work better for Python than it does for other languages for some reason.</li>

<li>The official Python docs site &mdash;


<a href="http://docs.python.org">docs.python.org</a> &mdash; has high quality
docs. Nonetheless, I often find a Google search of a couple words to be
quicker.</li>

<li>There is also an <a


href="http://mail.python.org/mailman/listinfo/tutor">official Tutor mailing
list</a> specifically designed for those who are new to Python and/or programming!
</li>
<li>Many questions (and answers) can be found on <a
href="http://stackoverflow.com/questions/tagged/python">StackOverflow</a> and <a
href="http://quora.com/Python-programming-language">Quora</a>.</li>
<li>Use the help() and dir() functions (see below).</li>
</ul>

<p>Inside the Python interpreter, the help() function pulls up documentation


strings for various modules, functions, and methods. These doc strings are similar
to Java's javadoc. The dir() function tells you what the attributes of an object
are. Below are some ways to call help() and dir() from the interpreter:

<ul>
<li><code translate="no" dir="ltr">help(len)</code> &mdash; help string for the
built-in <code translate="no" dir="ltr">len()</code> function; note that it's "len"
not "len()", which is a <strong>call</strong> to the function, which we don't
want</li>

<li><code translate="no" dir="ltr">help(sys)</code> &mdash; help string for the


<code translate="no" dir="ltr">sys</code> module (must do an <code translate="no"
dir="ltr">import sys</code> first)</li>

<li><code translate="no" dir="ltr">dir(sys)</code> &mdash; <code translate="no"


dir="ltr">dir()</code> is like <code translate="no" dir="ltr">help()</code> but
just gives a quick list of its defined symbols, or "attributes"</li>

<li><code translate="no" dir="ltr">help(sys.exit)</code> &mdash; help string for


the <code translate="no" dir="ltr">exit()</code> function in the <code
translate="no" dir="ltr">sys</code> module</li>

<li><code translate="no" dir="ltr">help('xyz'.split)</code> &mdash; help string


for the <code translate="no" dir="ltr">split()</code> method for string objects.
You can call <code translate="no" dir="ltr">help()</code> with that object itself
or an <strong>example</strong> of that object, plus its attribute. For example,
calling <code translate="no" dir="ltr">help('xyz'.split)</code> is the same as
calling <code translate="no" dir="ltr">help(str.split)</code>.</li>

<li><code translate="no" dir="ltr">help(list)</code> &mdash; help string for


<code translate="no" dir="ltr">list</code> objects</li>

<li><code translate="no" dir="ltr">dir(list)</code> &mdash; displays <code


translate="no" dir="ltr">list</code> object attributes, including its methods</li>

<li><code translate="no" dir="ltr">help(list.append)</code> &mdash; help string


for the <code translate="no" dir="ltr">append()</code> method for <code
translate="no" dir="ltr">list</code> objects</li>
</ul>

</div>

<devsite-thumb-rating position="footer">
<template class="thumb-down-categories">
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples/Code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
</template>
<template class="thumb-up-categories">
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
</template>

</devsite-thumb-rating>

</article>

<devsite-content-footer class="nocontent">
<p>Except as otherwise noted, the content of this page is licensed under the <a
href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution
4.0 License</a>, and code samples are licensed under the <a
href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. For
details, see the <a href="https://developers.google.com/site-policies">Google
Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its
affiliates.</p>
<p>Last updated 2018-08-20 UTC.</p>
</devsite-content-footer>

</devsite-content>
</main>
<devsite-footer-promos class="devsite-footer">
</devsite-footer-promos>
<devsite-footer-linkboxes class="devsite-footer">

<nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links">

<ul class="devsite-footer-linkboxes-list">

<li class="devsite-footer-linkbox ">


<h3 class="devsite-footer-linkbox-heading no-link">Connect</h3>
<ul class="devsite-footer-linkbox-list">

<li class="devsite-footer-linkbox-item">

<a href="//googledevelopers.blogspot.com"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 1)"


>

Blog

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//www.facebook.com/Google-Developers-967415219957038"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 2)"


>

Facebook

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//medium.com/google-developers"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 3)"


>

Medium

</a>

</li>

<li class="devsite-footer-linkbox-item">
<a href="//twitter.com/googledevs"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 4)"


>

Twitter

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//www.youtube.com/user/GoogleDevelopers"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 5)"


>

YouTube

</a>

</li>

</ul>
</li>

<li class="devsite-footer-linkbox ">


<h3 class="devsite-footer-linkbox-heading no-link">Programs</h3>
<ul class="devsite-footer-linkbox-list">

<li class="devsite-footer-linkbox-item">

<a href="//www.womentechmakers.com"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 1)"


>

Women Techmakers

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="/community/gdg"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 2)"


>
Google Developer Groups

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="/community/experts"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 3)"


>

Google Developers Experts

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="/community/accelerators"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 4)"


>

Accelerators

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="/community/dsc"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 5)"


>

Developer Student Clubs

</a>

</li>

</ul>
</li>

<li class="devsite-footer-linkbox ">


<h3 class="devsite-footer-linkbox-heading no-link">Developer consoles</h3>
<ul class="devsite-footer-linkbox-list">
<li class="devsite-footer-linkbox-item">

<a href="//console.developers.google.com"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 1)"


>

Google API Console

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//console.cloud.google.com"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 2)"


>

Google Cloud Platform Console

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//play.google.com/apps/publish"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 3)"


>

Google Play Console

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//console.firebase.google.com"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 4)"


>

Firebase Console

</a>

</li>
<li class="devsite-footer-linkbox-item">

<a href="//console.actions.google.com"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 5)"


>

Actions on Google Console

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//cast.google.com/publish"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 6)"


>

Cast SDK Developer Console

</a>

</li>

<li class="devsite-footer-linkbox-item">

<a href="//chrome.google.com/webstore/developer/dashboard"
class="devsite-footer-linkbox-link gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Link (index 7)"


>

Chrome Web Store Dashboard

</a>

</li>

</ul>
</li>

</ul>

</nav>

</devsite-footer-linkboxes>
<devsite-footer-utility class="devsite-footer">

<div class="devsite-footer-utility nocontent">


<nav class="devsite-footer-sites" aria-label="Other Google Developers websites">
<a href="https://developers.google.com/"
class="devsite-footer-sites-logo-link gc-analytics-event"
data-category="Site-Wide Custom Events"
data-label="Footer Google Developers Link">
<img class="devsite-footer-sites-logo"
src="https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers/images/lockup-developers.svg"
loading="lazy"
alt="Google Developers">
</a>
<ul class="devsite-footer-sites-list">

<li class="devsite-footer-sites-item">
<a href="//developer.android.com"
class="devsite-footer-sites-link
gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Android Link"

>
Android
</a>
</li>

<li class="devsite-footer-sites-item">
<a href="//developer.chrome.com/home"
class="devsite-footer-sites-link
gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Chrome Link"

>
Chrome
</a>
</li>

<li class="devsite-footer-sites-item">
<a href="//firebase.google.com"
class="devsite-footer-sites-link
gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Firebase Link"

>
Firebase
</a>
</li>

<li class="devsite-footer-sites-item">
<a href="//cloud.google.com"
class="devsite-footer-sites-link
gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer Google Cloud Platform Link"

>
Google Cloud Platform
</a>
</li>

<li class="devsite-footer-sites-item">
<a href="/products"
class="devsite-footer-sites-link
gc-analytics-event"
data-category="Site-Wide Custom Events"

data-label="Footer All products Link"

>
All products
</a>
</li>

</ul>
</nav>

<nav class="devsite-footer-utility-links" aria-label="Utility links">

<ul class="devsite-footer-utility-list">

<li class="devsite-footer-utility-item
">

<a class="devsite-footer-utility-link gc-analytics-event"


href="/terms/site-terms"
data-category="Site-Wide Custom Events"
data-label="Footer Terms link"
>
Terms
</a>

</li>

<li class="devsite-footer-utility-item
">

<a class="devsite-footer-utility-link gc-analytics-event"


href="//policies.google.com/privacy"
data-category="Site-Wide Custom Events"
data-label="Footer Privacy link"
>
Privacy
</a>

</li>
<li class="devsite-footer-utility-item
devsite-footer-utility-button">

<span class="devsite-footer-utility-description">Sign up for the Google


Developers newsletter</span>

<a class="devsite-footer-utility-link gc-analytics-event"


href="//services.google.com/fb/forms/googledevelopersnewsletter/?
utm_medium=referral&amp;utm_source=google-
products&amp;utm_team=googledevs&amp;utm_campaign=201611-newsletter-launch"
data-category="Site-Wide Custom Events"
data-label="Footer Subscribe link"
>
Subscribe
</a>

</li>

</ul>

<devsite-language-selector>
<devsite-select class="devsite-language-selector-menu">

<select aria-label="Select your language preference."


class="devsite-language-selector-select"
name="language"
track-name="click"
track-type="languageSelector">

<option>Language</option>

<option value="en"
lang="en"
track-metadata-original-language="en"
track-metadata-selected-language="en"
track-name="changed"
track-type="languageSelector"
>
English
</option>

<option value="id"
lang="id"
track-metadata-original-language="en"
track-metadata-selected-language="id"
track-name="changed"
track-type="languageSelector"
>
Bahasa Indonesia
</option>

<option value="de"
lang="de"
track-metadata-original-language="en"
track-metadata-selected-language="de"
track-name="changed"
track-type="languageSelector"
>
Deutsch
</option>

<option value="es"
lang="es"
track-metadata-original-language="en"
track-metadata-selected-language="es"
track-name="changed"
track-type="languageSelector"
>
Español
</option>

<option value="fr"
lang="fr"
track-metadata-original-language="en"
track-metadata-selected-language="fr"
track-name="changed"
track-type="languageSelector"
>
Français
</option>

<option value="pt_br"
lang="pt_br"
track-metadata-original-language="en"
track-metadata-selected-language="pt_br"
track-name="changed"
track-type="languageSelector"
>
Português – Brasil
</option>

<option value="ru"
lang="ru"
track-metadata-original-language="en"
track-metadata-selected-language="ru"
track-name="changed"
track-type="languageSelector"
>
Русский
</option>

<option value="zh_cn"
lang="zh_cn"
track-metadata-original-language="en"
track-metadata-selected-language="zh_cn"
track-name="changed"
track-type="languageSelector"
>
中文 – 简体
</option>

<option value="ja"
lang="ja"
track-metadata-original-language="en"
track-metadata-selected-language="ja"
track-name="changed"
track-type="languageSelector"
>
日本語
</option>

<option value="ko"
lang="ko"
track-metadata-original-language="en"
track-metadata-selected-language="ko"
track-name="changed"
track-type="languageSelector"
>
한국어
</option>

</select>
</devsite-select>
</devsite-language-selector>

</nav>
</div>

</devsite-footer-utility>
</section></section>
<devsite-sitemask></devsite-sitemask>
<devsite-snackbar
></devsite-snackbar>
<devsite-tooltip ></devsite-tooltip>
<devsite-heading-link></devsite-heading-link>
<devsite-analytics enable-analytics-iframe>

<script type="application/json" analytics>[{"gaid": "UA-24532603-1",


"dimensions": {"dimension8": null, "dimension3": false, "dimension6": "en",
"dimension5": "en", "dimension11": false, "dimension4": "Python Education",
"dimension1": "Signed In"}, "metrics": {"ratings_value": "metric1",
"ratings_count": "metric2"}}]</script>
<script type="application/json" gtm>{"parameters": {"freeTrialEligibleUser":
"False", "internalUser": "False", "language": {"machineTranslated": "False",
"requested": "en", "served": "en"}, "pageType": "article", "projectName": "Python
Education", "scriptsafe": null, "signedIn": "True", "tenant": "developers",
"recommendations": {"sourcePage": "", "sourceType": 0, "sourceRank": 0,
"sourceIdenticalDescriptions": 0, "sourceTitleWords": 0, "sourceDescriptionWords":
0, "experiment": ""}}}</script>

</devsite-analytics>

<devsite-badger></devsite-badger>

<script nonce="2sT2Cm2iGxerSJH6xHcQwoc9HCHsa1">

(function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i;
t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0];
E.parentNode.insertBefore(t,E);})(window, document, 'script',
'https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers/js/app_loader.js',
'[1,"en",null,"/js/devsite_app_module.js","https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea","ht
tps://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers","https://developers-dot-devsite-v2-prod.appspot.com",null,null,
["/_pwa/developers/manifest.json","https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/imag
es/video-placeholder.svg","https://www.gstatic.com/devrel-
devsite/prod/v1674d466be3b1154327dd11cf186e748303b1e92ae31ff35df0f5192fbd777ea/deve
lopers/images/favicon.png","https://fonts.googleapis.com/css?
family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|
Roboto+Mono:400,500,700|Material+Icons"],1,null,
[1,6,8,12,14,17,21,25,40,45,50,63,70,75,76,80,87,88,91,92,93,97,98,100,101,102,103,
105,107,108,111,112,113,115,116,117,118,120,122,123,124,125,127,129,131,132,133,134
,135,136],"AIzaSyAP-jjEJBzmIyKR4F-
3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg"]')

</script>
<devsite-a11y-announce></devsite-a11y-announce>
</body>
</html>

You might also like