[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-711080-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-711080-en":130,"doc-similar-711080":274},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","think-python-a-guide-to-thinking-like-a-computer-scientist","Think Python - A guide to thinking like a computer scientist","","Think Python explains how to think like a computer scientist through learning the Python programming language and using it to reason about programs. The book introduces core concepts such as programs, debugging, variables, expressions, statements, and the distinction between formal and natural languages. It further covers functions, execution flow, parameters and arguments, local scope, and stack diagrams. Each chapter includes a glossary and exercises to reinforce skills with practical problem solving.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/think-python-a-guide-to-thinking-like-a-computer-scientist/711080/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/think-python-a-guide-to-thinking-like-a-computer-scientist/711080.png","ImageObject",300,407,{"name":42,"@type":43},"Rhys","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-20","2026-11-15",true,{"@type":52,"interactionType":53,"userInteractionCount":26},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What does Think Python teach readers to do?","Question",{"text":62,"@type":63},"It teaches readers to think like a computer scientist by using Python to understand how programs work, including core ideas like debugging and program reasoning.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How does the book approach debugging?",{"text":67,"@type":63},"It explains debugging as a process and introduces common categories of errors, including syntax, runtime, and semantic errors, along with exercises for practice.",{"name":69,"@type":60,"acceptedAnswer":70},"What are the main topics covered in the early chapters?",{"text":71,"@type":63},"The early chapters cover the structure of programs, variables and expressions, order of operations, string operations and comments, and then progress to functions, including parameters, local scope, and stack diagrams.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},711080,1794782802,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":26,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":79,"read_time":144,"preview_page_count":145,"preview_urls":146},687207024643,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","Think Python How to Think Like a Computer Scientist  \n© Allen Downey  \nThis work is licensed under a Creative Commons-NonCommercial-ShareAlike 4.0 International License  \nOriginal source: Green Tea Press  \n[http://www.thinkpython.com](http://www.thinkpython.com)  \nContents  \nPreface ............................................................................................................................ 1  \nThe strange history of this book ............................................................................................. 1  \nAcknowledgments ...................................................................................................................2  \nContributor List .........................................................................................................................3  \nChapter 1 The way of the program ..............................................................................8  \n1.1 The Python programming language ................................................................................8  \n1.2 What is a program? .........................................................................................................10  \n1.3 What is debugging? .........................................................................................................10  \n1.3.1 Syntax errors .........................................................................................................11  \n1.3.2 Runtime errors .....................................................................................................11  \n1.3.3 Semantic errors ....................................................................................................11  \n1.3.4 Experimental debugging .....................................................................................12  \n1.4 Formal and natural languages ........................................................................................12  \n1.5 The ﬁrst program ..............................................................................................................14  \n1.6 Debugging ........................................................................................................................15  \n1.7 Glossary .............................................................................................................................15  \n1.8 Exercises ............................................................................................................................17  \nChapter 2 Variables, expressions and statements ..................................................18  \n2.1 Values and types...............................................................................................................18  \n2.2 Variables ...........................................................................................................................19  \n2.3 Variable names and keywords ........................................................................................20  \n2.4 Operators and operands .................................................................................................21  \n2.5 Expressions and statements ..........................................................................................21  \n2.6 Interactive mode and script mode .................................................................................22  \n2.7 Order of operations ........................................................................................................23  \n2.8 String operations ..............................................................................................................24  \n2.9 Comments .........................................................................................................................24  \n2.10 Debugging .......................................................................................................................25  \n2.11 Glossary ..........................................","cbCaiuIoj0QbKokB","https://ap.wps.com/l/cbCaiuIoj0QbKokB","pdf",3455885,278,"English","# Preface\n## The strange history of this book\n## Acknowledgments\n## Contributor List\n# Chapter 1 The way of the program\n## The Python programming language\n## What is a program?\n## What is debugging?\n## Formal and natural languages\n## The first program\n## Debugging\n## Glossary\n## Exercises\n# Chapter 2 Variables, expressions and statements\n## Values and types\n## Variables\n## Variable names and keywords\n## Operators and operands\n## Expressions and statements\n## Interactive mode and script mode\n## Order of operations\n## String operations\n## Comments\n## Debugging\n## Glossary\n## Exercises\n# Chapter 3 Functions\n## Function calls\n## Type conversion functions\n## Math functions\n## Composition\n## Adding new functions\n## Definitions and uses\n## Flow of execution\n## Parameters and arguments\n## Variables and parameters are local\n## Stack diagrams\n## Fruitful functions and void functions\n## Why functions?\n## Importing with from","[{\"question\":\"What does Think Python teach readers to do?\",\"answer\":\"It teaches readers to think like a computer scientist by using Python to understand how programs work, including core ideas like debugging and program reasoning.\"},{\"question\":\"How does the book approach debugging?\",\"answer\":\"It explains debugging as a process and introduces common categories of errors, including syntax, runtime, and semantic errors, along with exercises for practice.\"},{\"question\":\"What are the main topics covered in the early chapters?\",\"answer\":\"The early chapters cover the structure of programs, variables and expressions, order of operations, string operations and comments, and then progress to functions, including parameters, local scope, and stack diagrams.\"}]","Think Python - A guide to thinking like a computer scientist | PDF",701,28,[147,151,155,159,163,167,171,175,179,183,187,192,197,202,207,212,217,222,227,231,235,240,245,250,255,260,265,270],{"page_no":22,"url":148,"width":149,"height":150},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/8811d1eadda1949637515d7ef306d679.webp",983,1390,{"page_no":26,"url":152,"width":153,"height":154},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/bca01fde81f20bdeb93e532c75b54607.webp",982,1389,{"page_no":30,"url":156,"width":157,"height":158},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/22451ec8b327824d4244416c82d6da63.webp",981,1387,{"page_no":33,"url":160,"width":161,"height":162},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/b7860d907f8b8e8244e9e2ae8ac3fe6d.webp",980,1386,{"page_no":96,"url":164,"width":165,"height":166},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/f70605a2fda756e8b4ebbdd6670c20a2.webp",979,1385,{"page_no":101,"url":168,"width":169,"height":170},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/6de75c3675f0c013c5f2695710663847.webp",978,1383,{"page_no":105,"url":172,"width":173,"height":174},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/6eed9db73fe99b306fab8ff630e1af20.webp",977,1382,{"page_no":110,"url":176,"width":177,"height":178},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/b9f6a1d61a162777197d6dcde939f143.webp",976,1380,{"page_no":115,"url":180,"width":181,"height":182},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/14887b9cc8344a9f713bac92505ecacc.webp",975,1379,{"page_no":123,"url":184,"width":185,"height":186},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/091143c935b15527b56749cef8407c7a.webp",974,1378,{"page_no":188,"url":189,"width":190,"height":191},11,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/8edd98890f2883b5518f759c20daa6d5.webp",973,1376,{"page_no":193,"url":194,"width":195,"height":196},12,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/3db65433f55bd631956281d900ec79d3.webp",972,1375,{"page_no":198,"url":199,"width":200,"height":201},13,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/d509de6ee9c7ac586fdaa351c44a5545.webp",971,1373,{"page_no":203,"url":204,"width":205,"height":206},14,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/c5ddee88c6cd6c1ad4a804c852381e80.webp",970,1372,{"page_no":208,"url":209,"width":210,"height":211},15,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/aa6143b6d97437f2a3a87bcc6a332c22.webp",969,1370,{"page_no":213,"url":214,"width":215,"height":216},16,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/57d0faafe962871c8ff92c631cfff184.webp",968,1369,{"page_no":218,"url":219,"width":220,"height":221},17,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/9352747a9fbf8745381e9ea1802937c4.webp",967,1368,{"page_no":223,"url":224,"width":225,"height":226},18,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/1b939f7ee8cc4d5086899800486bc9bc.webp",966,1366,{"page_no":127,"url":228,"width":229,"height":230},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/58111dfb1ee9c54229789c92bb582192.webp",965,1365,{"page_no":117,"url":232,"width":233,"height":234},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/226eb8507a1ead5e510521b480566b09.webp",964,1363,{"page_no":236,"url":237,"width":238,"height":239},21,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/a3bc4695a92c11cf90e04c7df28cc4b0.webp",963,1362,{"page_no":241,"url":242,"width":243,"height":244},22,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/3bca2ace1ba4ba582cbbc2c532107f07.webp",962,1361,{"page_no":246,"url":247,"width":248,"height":249},23,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/24575660204644448b9417cb05b6ed2c.webp",961,1359,{"page_no":251,"url":252,"width":253,"height":254},24,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/9e680f81fe8116e667c473c998351e42.webp",960,1358,{"page_no":256,"url":257,"width":258,"height":259},25,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/2165fdf79a04fddab2fdf54a9b68fcff.webp",959,1356,{"page_no":261,"url":262,"width":263,"height":264},26,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/65867f9efdb5d13434a3e9622fc77f7f.webp",958,1355,{"page_no":266,"url":267,"width":268,"height":269},27,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/02c723e97532ac9f1c05a55861c2e11f.webp",957,1354,{"page_no":145,"url":271,"width":272,"height":273},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-15/192bacd644b4108e35bf479055ca20fc.webp",956,1352,{"list":275,"token":11},[276,282,287,293,299,305,311,317,323,329],{"doc_id":277,"doc_title":278,"file_type":137,"home_preview_img_url":279,"slug":280,"view_count":208,"category_name":29,"create_tm":281},417792,"Python glossary of terms","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922495520/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=vNNWAe4YqS5g7E08zcEgaIlVazI%3D","python-glossary-of-terms",1790610644,{"doc_id":283,"doc_title":284,"file_type":137,"home_preview_img_url":285,"slug":286,"view_count":198,"category_name":29,"create_tm":281},417793,"Python Programming Basics - Overview of Interpreters, Translation, and Key Vocabulary","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229921866711/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=zhGHUlCyt8EhIeWBUkzbJeHlNvU%3D","python-programming-basics-overview-of-interpreters-translation-and-key-vocabulary",{"doc_id":288,"doc_title":289,"file_type":137,"home_preview_img_url":290,"slug":291,"view_count":198,"category_name":29,"create_tm":292},423012,"Think Java - How to Think Like a Computer Scientist - Version 6.6.0","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922611452/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=ThD6JGK8FPIl2ZjytjzNAZ0OUpE%3D","think-java-how-to-think-like-a-computer-scientist-version-660",1790629747,{"doc_id":294,"doc_title":295,"file_type":137,"home_preview_img_url":296,"slug":297,"view_count":33,"category_name":29,"create_tm":298},685653,"Introduction to Programming Languages and Tools of the Trade - Lesson Overview","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999685614/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=ty17PnNAH6qkI0E24fOtBO4otZs%3D","introduction-to-programming-languages-and-tools-of-the-trade-lesson-overview",1794016330,{"doc_id":300,"doc_title":301,"file_type":137,"home_preview_img_url":302,"slug":303,"view_count":261,"category_name":29,"create_tm":304},150822,"TechnoTurtle Python - Teacher Guide - Lessons for Elementary School Students","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229869770512/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=h%2BzQaNUjIYMY82htQXqk5zno1iE%3D","technoturtle-python-teacher-guide-lessons-for-elementary-school-students",1787827634,{"doc_id":306,"doc_title":307,"file_type":137,"home_preview_img_url":308,"slug":309,"view_count":33,"category_name":29,"create_tm":310},671798,"Python - Visual QuickStart Guide Table of Contents - Chapter 1 to Appendix B","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988403999/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=7eFLtUZ6wen2Wihelv15Rp7nN6Y%3D","python-visual-quickstart-guide-table-of-contents-chapter-1-to-appendix-b",1793580658,{"doc_id":312,"doc_title":313,"file_type":137,"home_preview_img_url":314,"slug":315,"view_count":33,"category_name":29,"create_tm":316},732869,"Levels of Programming Languages - Lecture 2","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031413403/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=2NrAmGdwu7ykTm1mdiFOW3vnpus%3D","levels-of-programming-languages-lecture-2",1795382636,{"doc_id":318,"doc_title":319,"file_type":137,"home_preview_img_url":320,"slug":321,"view_count":30,"category_name":29,"create_tm":322},682644,"Visual QuickStart Guide - Python - Third Edition - Learn the quick and easy way","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999674919/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=NKQ6z9SZklFmxcCHilmd4bzEujk%3D","visual-quickstart-guide-python-third-edition-learn-the-quick-and-easy-way",1793977303,{"doc_id":324,"doc_title":325,"file_type":137,"home_preview_img_url":326,"slug":327,"view_count":101,"category_name":29,"create_tm":328},685646,"Programming 101 - Introduction - Programming Basics for FIRST Robotics Competition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999685569/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=dADIcJQ%2FMWjWBHh5Guzj9i8oOkI%3D","programming-101-introduction-programming-basics-for-first-robotics-competition",1794016318,{"doc_id":330,"doc_title":331,"file_type":137,"home_preview_img_url":332,"slug":333,"view_count":33,"category_name":29,"create_tm":334},685638,"Programming Languages and C++ - Bloomberg Frankfurt March 19, 2019","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999084245/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796115719&Signature=jBN54PIhbEWfvOzblCbkI%2BHknQY%3D","programming-languages-and-c-bloomberg-frankfurt-march-19-2019",1794016112]