[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571390-105":53,"doc-detail-571390-en":127},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","quick-reference-python-3-python-essentials-at-a-glance-syntax-collections-control-flow-practical-tools","QUICK REFERENCE - PYTHON 3 - Python Essentials, at a glance - Syntax & Collections - Control Flow & Practical Tools","","Quick Reference for Python 3 provides a compact, at-a-glance cheat sheet covering core language syntax and everyday programming patterns. It explains essentials such as variables and types, operators and truthiness, strings, lists, indexing and slicing, dictionaries, tuples and sets, and comprehensions. It also covers control flow with conditionals and loops, function definitions and arguments, input and exception handling, file I/O with JSON, useful built-ins, class basics, virtual environments, and key reminders for correctness.",{"@graph":63,"@context":119},[64,80,102],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/quick-reference-python-3-python-essentials-at-a-glance-syntax-collections-control-flow-practical-tools/571390/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/quick-reference-python-3-python-essentials-at-a-glance-syntax-collections-control-flow-practical-tools/571390.png","ImageObject",442,249,{"name":88,"@type":89},"Ivy","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",6,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do you start Python 3 from the command line and check the version?","Question",{"text":109,"@type":110},"Run python3 --version to see the installed version. On Windows, use python or py to open the interactive shell. You can also run scripts like python3 app.py.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"What are the differences between list sort() and sorted()?",{"text":114,"@type":110},"sort() modifies the existing list and returns None. sorted() creates and returns a new sorted list without changing the original.",{"name":116,"@type":107,"acceptedAnswer":117},"How do you handle invalid user input and convert types in Python?",{"text":118,"@type":110},"Use input() to read text and convert it as needed (e.g., int(input(...))). Wrap conversions in try/except for specific exceptions like ValueError, and use else to run code when conversion succeeds.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},571390,1792294656,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":9},549758252649,"https://ap-avatar.wpscdn.com/avatar/8000253669c5317157?_k=1778319167496531819","QUICK REFERENCE / PYTHON 3  \nPython The essentials, at a glance.  \n  DevSheets  \n01 / SYNTAX & COLLECTIONS  \n 01  Start here  \nInstall: [python.org/downloads](python.org/downloads)  \npython3 --version  \npython3 app .py  \nWindows: use python or py. Run python3 alone to open the interactive shell.  \nUse 4 spaces per indent. A \\# starts a comment.  \n 02  Variables & types  \nname = \"Maya\"age = 28  \nprice = 19.95 active = True result = None  \n\\# str  \n\\# int  \n\\# float  \n\\# bool  \n\\# no value  \nUse snake_case names. True, False, and None are capitalized. No type declaration is required.  \n 03  Operators & truthiness  \n+ - * /// % **== != \u003C > \u003C= >= and or not  \nin / not in  \n7 / 2 7 // 2  \n2 ** 3  \n\\# 3.5  \n\\# 3  \n\\# 8  \nArithmetic  \nFloor, remainder, power Compare values Boolean operators  \nMembership  \nFalse, None, zero, and empty strings or collections are falsy. Check None with is None.  \n 04  Strings  \nText is immutable; methods return new values.  \nname = \"Maya\"  \nf\"Hi, {name}!\" \\# 'Hi, Maya!'  \nf\"{3.14159 : .2f}\" \\# '3 .14'  \n\" hi \" .strip() \\# 'hi'  \n\"Hello\" .lower() \\# 'hello'  \n\"a,b\" .split(\",\") \\# ['a', 'b']  \n\" - \" .join([ \"a\" , \"b\"]) \\# 'a-b'  \n\"cat\" . replace( \"c\" , \"b\") \\# 'bat'  \n 05  Lists  \nOrdered and mutable; duplicates are allowed.  \nnums = [10 , 20 , 30]  \nnums.append(40) \\# add one  \nnums.extend([50 , 60]) \\# add many  \nnums . remove(20) \\# first match  \nlast = nums.pop() \\# remove last  \nlen(nums) \\# item count  \nnums.sort() \\# change nums  \nordered = sorted(nums) \\# new list  \nsort() changes the list and returns None. sorted() returns anew sorted list.  \n 06  Indexing & slicing  \ntext = \"Python\"  \ntext[0]  \ntext[-1]  \ntext[1:4]  \ntext[::-1]  \n\\# 'P'  \n\\# 'n'  \n\\# 'yth'  \n\\# 'nohtyP'  \nsequence[start:stop:step]. Start is included; stop is excluded. Works with lists and tuples too.  \n 07  Dictionaries  \nMutable key-value mappings. Keys are unique and must be hashable, such as strings or numbers.  \nuser = { \"name\" : \"Maya\" , \"age\" : 28}  \nuser[\"name\"] \\# 'Maya'  \nuser[\"age\"] = 29  \nuser.get( \"role\" , \"guest\") \\# fallback  \n\"name\" in user \\# True  \nfor key, value in user .items():  \nprint(key, value)  \nd[key] raises KeyError for a missing key. get() reads a fallback without adding the key.  \n 08  Tuples & sets  \npoint = (10 , 20)  \nx, y = point \\# unpack  \nsingle = (42,) \\# one-item tuple  \ntags = { \"web\" , \"api\" , \"web\"} tags.add(\"python\")  \ntags.discard(\"api\") \\# safe if absent {1 , 2} | {2 , 3} \\# union: {1, 2, 3}  \n{1 , 2} & {2 , 3} \\# intersection: {2}  \nTuples are immutable. Sets hold unique, hashable values in no guaranteed order. Empty set: set().  \n 09  Comprehensions  \nnums = [1 , 2 , 3 , 4]  \nsquares = [n * n for n in nums]  \nevens = [n for n in nums if n % 2 == 0] unique = {n % 2 for n in nums}  \nUse [] for a list, {key: value} for a dict, and {value} for a set. Add if to filter.  \nQUICK REFERENCE / PYTHON 3  \nPython Everyday patterns, ready to use.  \n  DevSheets  \n02 / CONTROL FLOW & PRACTICAL TOOLS  \n 10  Conditionals  \nscore = 82  \nif score >= grade =  \n90 :  \n\"A\"  \nelif score >= 80 :  \ngrade = else :  \ngrade =  \n\"B\"  \n\"C\"  \n 11  Loops  \nfor n in range (3):  \nprint(n) \\# 0, then 1, then 2  \nnames = [ \"Maya\" , \"Leo\"]  \nfor i, name in enumerate(names, start=1):  \nprint(i, name)  \ncount = 3  \nwhile count > 0 :  \ncount - = 1  \nrange(start, stop, step) excludes stop. break exits the loop; continue skips to the next iteration.  \n 12  Functions  \ndef greet(name, greeting=\"Hello\"):  \nreturn f\"{greeting}, {name}!\"  \ngreet(\"Maya\")  \ngreet( \"Leo\" , greeting=\"Hi\")  \n*args collects positional arguments; **kwargs collects keyword arguments. Without return, a function returns None.  \n 13  Input & exceptions  \ninput() returns a string. Convert it when you need a number, and handle invalid input.  \ntry :  \nage = int (input(\"Age: \" )) except ValueError :  \nprint (\"Enter a whole number.\" ) else :  \nprint(f\"Next year: {age + 1}\")  \nAlso: float(\"3.5\") converts to a float; str(42) converts to text. Catch specific error","cbCaiscvYnYzS9fL","https://ap.wps.com/l/cbCaiscvYnYzS9fL","pdf",80312,"English","# 01 / Syntax & Collections\n## 01 Start here\n## 02 Variables & types\n## 03 Operators & truthiness\n## 04 Strings\n## 05 Lists\n## 06 Indexing & slicing\n## 07 Dictionaries\n## 08 Tuples & sets\n## 09 Comprehensions\n# 02 / Control Flow & Practical Tools\n## 10 Conditionals\n## 11 Loops\n## 12 Functions\n## 13 Input & exceptions\n## 14 Files & JSON\n## 15 Useful built-ins\n## 16 Classes\n## 17 Virtual environments\n## 18 Remember these","[{\"question\":\"How do you start Python 3 from the command line and check the version?\",\"answer\":\"Run python3 --version to see the installed version. On Windows, use python or py to open the interactive shell. You can also run scripts like python3 app.py.\"},{\"question\":\"What are the differences between list sort() and sorted()?\",\"answer\":\"sort() modifies the existing list and returns None. sorted() creates and returns a new sorted list without changing the original.\"},{\"question\":\"How do you handle invalid user input and convert types in Python?\",\"answer\":\"Use input() to read text and convert it as needed (e.g., int(input(...))). Wrap conversions in try/except for specific exceptions like ValueError, and use else to run code when conversion succeeds.\"}]","QUICK REFERENCE - PYTHON 3 - Python Essentials, at a glance - Syntax & Collections - Control Flow & Practical Tools | PDF",1791914949]