CINXE.COM

Python Tutorial

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="keywords" content="python tutorial, programming, scripting, tutorials, how to, download"> <meta name="Description" content="Learn how to code in Python. Python is a high-level programming language for general-purpose programming."> <link rel="canonical" href="https://www.quackit.com/python/tutorial/"> <title>Python Tutorial</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <link rel="shortcut icon" href="/pix/favicon96.png"> <link rel="apple-touch-icon" href="/pix/apple-touch-icon.png"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet"> <link href="/common/css/master.45.min.css" rel="stylesheet"> <script async src="https://cdn.fuseplatform.net/publift/tags/2/3499/fuse.js"></script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-Q3H025ZKLN"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-Q3H025ZKLN'); </script> </head> <body> <header class="site-header"> <div class="site-header-base"> <div class="site-logo"> <a title="Quackit Homepage" target="_top" href="/"><img src="/pix/quackit_logo_watermark.png" width="87" height="33" alt="Quackit Logo"></a> </div> <button id="site-nav-toggler" class="site-nav-toggler" aria-expanded="false" aria-controls="site-nav"> <span class="sr-only">Toggle navigation</span> &#9776; </button> </div> <nav id="site-nav" class="site-nav"> <div class="site-links"> <ul> <li><a href="/"><i class="fa fa-home"></i> <span class="sr-only">Home</span></a></li> <li><a href="/html/">HTML</a></li> <li><a href="/css/">CSS</a></li> <li><a href="/scripting/">Scripting</a></li> <li><a href="/database/">Database</a></li> </ul> </div> <div class="site-search-top"> <form action="/search/" id="cse-search-box-bottom" class="site-search"> <div> <input type="hidden" name="cx" value="partner-pub-6331358926293806:98x0fk-bbgi"> <input type="hidden" name="cof" value="FORID:10"> <input type="hidden" name="ie" value="ISO-8859-1"> <input type="text" name="q" size="20" class="site-search-input"> <button type="submit" name="sa" class="site-search-button"><i class="fa fa-search"></i></button> </div> </form> </div> </nav> </header> <div class="main"> <article class="content"> <h1 class="page-title">Python Tutorial</h1> <div class="ad ad-top"> <!-- GAM 71161633/QCKIT_quackit/category_header --> <div data-fuse="23059883638"></div> </div> <ul class="pager"> <li><a href="/scripting/"><i class="fa fa-long-arrow-left" aria-hidden="true"></i> Scripting</a></li> <li><a href="/python/tutorial/about_python.cfm">About Python <i class="fa fa-long-arrow-right" aria-hidden="true"></i></a></li> </ul> <p class="lead">Learn how to code in Python. Quick and easy tutorial for beginners.</p> <h2>Python Tutorial</h2> <div class="index"> <div class="row"> <div class="col-2"> <ul> <li><a href="/python/tutorial/about_python.cfm">Python 3 - About</a></li> <li><a href="/python/tutorial/python_installation.cfm">Python 3 - Installation</a></li> <li><a href="/python/tutorial/python_environment.cfm">Python 3 - Environment</a></li> <li><a href="/python/tutorial/python_hello_world.cfm">Python 3 - Hello World</a></li> <li><a href="/python/tutorial/python_variables.cfm">Python 3 - Variables</a></li> <li><a href="/python/tutorial/python_user_input.cfm">Python 3 - User Input</a></li> <li><a href="/python/tutorial/python_strings.cfm">Python 3 - Strings</a></li> <li><a href="/python/tutorial/python_lists.cfm">Python 3 - Lists</a></li> <li><a href="/python/tutorial/python_tuples.cfm">Python 3 - Tuples</a></li> <li><a href="/python/tutorial/python_dictionary.cfm">Python 3 - Dictionary</a></li> <li><a href="/python/tutorial/python_numbers.cfm">Python 3 - Numbers</a></li> <li><a href="/python/tutorial/python_operators.cfm">Python 3 - Operators</a></li> <li><a href="/python/tutorial/python_if_statements.cfm">Python 3 - If Statements</a></li> <li><a href="/python/tutorial/python_while_loops.cfm">Python 3 - While Loops</a></li> <li><a href="/python/tutorial/python_for_loops.cfm">Python 3 - For Loops</a></li> <li><a href="/python/tutorial/python_functions.cfm">Python 3 - Functions</a></li> <li><a href="/python/tutorial/python_modules.cfm">Python 3 - Modules</a></li> <li><a href="/python/tutorial/python_classes.cfm">Python 3 - Classes</a></li> <li><a href="/python/tutorial/python_read_write_files.cfm">Python 3 - Read/Write Files</a></li> </ul> </div> <div class="cell col-2"> <a href="/python/tutorial/about_python.cfm"><img src="/pix/stock/python_logo.png" alt="Python logo"> </a> </div> </div> </div> <p>Python was first created in 1989, and has become one of the world's most popular programming languages. Python is used by some of the largest companies on the planet, including Google, Dropbox, Mozilla, IBM, Facebook, Yahoo, and more.</p> <p>Python is extremely easy to learn &mdash; probably one of the easiest programming languages for beginners to pick up and understand. Check out this tutorial to see why. </p> <p>And in case you're wondering, this tutorial uses Python 3 in all its examples (Python 3.6.1 to be precise).</p> <ul class="pager"> <li><a href="/scripting/"><i class="fa fa-long-arrow-left" aria-hidden="true"></i> Scripting</a></li> <li><a href="/python/tutorial/about_python.cfm">About Python <i class="fa fa-long-arrow-right" aria-hidden="true"></i></a></li> </ul> <h2>Python Reference</h2> <p>Here are some Python reference articles with examples that you might find helpful.</p> <div class="index"> <ul> <li><a href="/python/reference/python_3_operators.cfm">Python 3 - Operators</a></li> <li><a href="/python/reference/python_3_escape_sequences.cfm">Python 3 - Escape Sequences</a></li> <li><a href="/python/reference/python_3_string_operators.cfm">Python 3 - String Operators</a></li> <li><a href="/python/reference/python_3_string_methods.cfm">Python 3 - String Methods</a></li> <li><a href="/python/reference/python_3_list_methods.cfm">Python 3 - List Methods</a></li> <li><a href="/python/reference/python_3_numeric_operations.cfm">Python 3 - Numeric Operations</a></li> <li><a href="/python/reference/python_3_built-in_exceptions.cfm">Python 3 - Built-in Exceptions</a></li> <li><a href="/python/reference/python_3_exception_hierarchy.cfm">Python 3 - Exception Hierarchy</a></li> </ul> </div> <ul class="pager"> <li><a href="/scripting/"><i class="fa fa-long-arrow-left" aria-hidden="true"></i> Scripting</a></li> <li><a href="/python/tutorial/about_python.cfm">About Python <i class="fa fa-long-arrow-right" aria-hidden="true"></i></a></li> </ul> </article> <div class="sidebar"> <nav> <ul> <li> <h3><a href="/python/tutorial/">Python Tutorial</a></h3> <ul> <li><a href="/python/tutorial/about_python.cfm">Python 3 - About</a></li> <li><a href="/python/tutorial/python_installation.cfm">Python 3 - Installation</a></li> <li><a href="/python/tutorial/python_environment.cfm">Python 3 - Environment</a></li> <li><a href="/python/tutorial/python_hello_world.cfm">Python 3 - Hello World</a></li> <li><a href="/python/tutorial/python_variables.cfm">Python 3 - Variables</a></li> <li><a href="/python/tutorial/python_user_input.cfm">Python 3 - User Input</a></li> <li><a href="/python/tutorial/python_strings.cfm">Python 3 - Strings</a></li> <li><a href="/python/tutorial/python_lists.cfm">Python 3 - Lists</a></li> <li><a href="/python/tutorial/python_tuples.cfm">Python 3 - Tuples</a></li> <li><a href="/python/tutorial/python_dictionary.cfm">Python 3 - Dictionary</a></li> <li><a href="/python/tutorial/python_numbers.cfm">Python 3 - Numbers</a></li> <li><a href="/python/tutorial/python_operators.cfm">Python 3 - Operators</a></li> <li><a href="/python/tutorial/python_if_statements.cfm">Python 3 - If Statements</a></li> <li><a href="/python/tutorial/python_while_loops.cfm">Python 3 - While Loops</a></li> <li><a href="/python/tutorial/python_for_loops.cfm">Python 3 - For Loops</a></li> <li><a href="/python/tutorial/python_functions.cfm">Python 3 - Functions</a></li> <li><a href="/python/tutorial/python_modules.cfm">Python 3 - Modules</a></li> <li><a href="/python/tutorial/python_classes.cfm">Python 3 - Classes</a></li> <li><a href="/python/tutorial/python_read_write_files.cfm">Python 3 - Read/Write Files</a></li> </ul> </li> <li> <h3 class="heading-only">Python Reference</h3> <ul> <li><a href="/python/reference/python_3_operators.cfm">Python 3 - Operators</a></li> <li><a href="/python/reference/python_3_escape_sequences.cfm">Python 3 - Escape Sequences</a></li> <li><a href="/python/reference/python_3_string_operators.cfm">Python 3 - String Operators</a></li> <li><a href="/python/reference/python_3_string_methods.cfm">Python 3 - String Methods</a></li> <li><a href="/python/reference/python_3_list_methods.cfm">Python 3 - List Methods</a></li> <li><a href="/python/reference/python_3_numeric_operations.cfm">Python 3 - Numeric Operations</a></li> <li><a href="/python/reference/python_3_built-in_exceptions.cfm">Python 3 - Built-in Exceptions</a></li> <li><a href="/python/reference/python_3_exception_hierarchy.cfm">Python 3 - Exception Hierarchy</a></li> </ul> </li> <li> <li> <h3><a href="/javascript/" title="">JavaScript</a></h3> <ul> <li><a href="/javascript/tutorial/" title="Client side scripting language">JavaScript Tutorial</a></li> <li><a href="/javascript/javascript_reserved_words.cfm" title="">JavaScript Reserved Words</a></li> <li><a href="/javascript/javascript_event_handlers.cfm" title="Introduction to the 12 JavaScript event handlers">JavaScript Event Handlers</a></li> <li><a href="/javascript/javascript_date_and_time_functions.cfm" title="Full listing of all JavaScript methods for dealing with date and time.">JavaScript Date &amp; Time</a></li> <li><a href="/javascript/examples/" title="">JavaScript Examples</a></li> </ul> </li> <li><h3><a href="/jquery/" title="">jQuery</a></h3> <ul> <li><a href="/jquery/tutorial/" title="">jQuery Tutorial</a></li> <li><a href="/jquery/examples/" title="">jQuery Examples</a></li> </ul> <li> <li><h3><a href="/json/" title="">JSON</a></h3> <ul> <li><a href="/json/tutorial/" title="Data format for exchanging data between applications and different environments.">JSON Tutorial</a></li> </ul> <li> <h3 class="heading-only">Server Side Scripting</h3> <ul> <li><a href="/python/tutorial/" title="">Python Tutorial</a></li> <li><a href="/coldfusion/tutorial/" title="">ColdFusion Tutorial</a></li> <li><a href="/php/tutorial/" title="">PHP Tutorial</a></li> <li><a href="/vbscript/tutorial/" title="">VBScript Tutorial</a></li> </ul> </li> </li> </ul> </nav> <div class="ad ad-left"> <!-- GAM 71161633/QCKIT_quackit/category_vrec_2 --> <div data-fuse="23059883641"></div> </div> </div> <div class="ads"> <div class="ad ad-right"> <!-- GAM 71161633/QCKIT_quackit/category_vrec_1 --> <div data-fuse="23059511718"></div> </div> </div> </div> <div class="searchbox-bottom"> <form action="/search/" id="cse-search-box-bottom" class="site-search"> <div> <input type="hidden" name="cx" value="partner-pub-6331358926293806:npmuvy-i8kk"> <input type="hidden" name="cof" value="FORID:10"> <input type="hidden" name="ie" value="ISO-8859-1"> <input type="text" name="q" size="30" class="site-search-input"> <button type="submit" name="sa" class="site-search-button"><i class="fa fa-search"></i></button> </div> </form> <script src="//cse.google.com/cse/brand?form=cse-search-box-bottom&amp;lang=en"></script> </div> <footer> <p class="about"><a href="/"><i class="fa fa-home"></i> Home</a> | <a href="/about.cfm" rel="nofollow">About</a> | <a href="/contact.cfm" rel="nofollow">Contact</a> | <a href="/terms_of_use.cfm" rel="nofollow">Terms&nbsp;of&nbsp;Use</a> | <a href="/privacy_policy.cfm" rel="nofollow">Privacy&nbsp;Policy</a></p> <p>&#169; Copyright 2000 - 2025 Quackit.com &nbsp;</p> </footer> <script src="/common/js/spectrum/spectrum.js"></script> <script src="/common/js/lightbox2-master/dist/js/lightbox.min.js" charset="utf-8"></script> <script> $(document).ready(function(){ $( "#site-nav-toggler" ).click(function() { $( "#site-nav" ).toggle( "slow" ); }); }); </script> <script> $(function(){var a=window.location.href;$(".sidebar nav a").each(function(){a==this.href&&$(this).closest("li").addClass("selected")})}); </script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10