[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571754-105":53,"doc-detail-571754-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","python-cheat-sheet-quick-reference","Python - Cheat Sheet - Quick reference","","Python cheat sheet covering core syntax and common operations. It explains whitespace significance, module imports, comment and print usage, and conditional logic using if/elif/else with boolean expressions. It provides examples for lists (indexing, slicing, length, counting, sorting, mutating), tuples, dictionaries (keys/values checks and CRUD-like updates), loops (for with enumerate and range, while with continue/break), and basic function definitions with default parameters and returns.",{"@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":51,"@type":70,"position":76},"https://docshare.wps.com/template/general/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/python-cheat-sheet-quick-reference/571754/",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/python-cheat-sheet-quick-reference/571754.png","ImageObject",442,249,{"name":88,"@type":89},"McGucket","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-22","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 conditional statements work in this Python cheat sheet?","Question",{"text":109,"@type":110},"It uses if/elif/else with boolean conditions, including comparisons and logical operators such as and/or/not. Examples show branching for weather and job matching.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"What list operations are demonstrated?",{"text":114,"@type":110},"The sheet includes indexing and slicing, len, count, sort, remove, append, pop, and membership tests like 75 in scores. It also shows how sorting changes element order.",{"name":116,"@type":107,"acceptedAnswer":117},"How are loops and functions illustrated?",{"text":118,"@type":110},"For loops iterate with enumerate and range, while while loops use continue and break to control flow. Functions are defined with def, can include default parameters, and return values from simple expressions.","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},571754,1792190062,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":50,"category_name":51,"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":9,"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":4},1236954412713,"https://us-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","Python   \nGeneral Information  \nWhitespace matters! Indent where needed . Import modules with \"import modulename\"  \n\\# This is a comment  \nprint(\"Hello, World!\") \\# prints to screen  \nConditional Statements  \nif isSunny:  \nprint('It's sunny!')  \nelif 90 \u003C= temp \u003C 100 and bath > 80: print('Bath is hot and full!')  \nelif not ((job == 'qa') or (usr == 'adm')): print('Match if not qa or adm')  \nelse:  \nprint('No match . Job is ' + job)  \nLists  \nscores = ['A', 'C', 90, 75, 'C']  \nscores[0] \\# 'A'  \nscores[1:3] \\# 'C', 90  \nscores[2:] \\# 90, 75, 'C'  \nscores[:1] \\# 'A'  \nscores[:-1] \\# 'A', 'C', 90, 75  \nlen(scores) \\# 5  \nscores.count('C') \\# 2  \nscores.sort() \\# 75, 90, 'A', 'C', 'C'  \nscores.remove('A') \\# removes 'A'  \nscores.append(100) \\# Adds 100 to list scores.pop() \\# removes the last item  \nscores.pop(2) \\# removes the third item  \n75 in scores \\# True  \n[TunnelsUp.com](TunnelsUp.com) v1.1  \nNumbers  \ntotal = 3 * 3 \\# 9  \ntotal = 5 + 2 * 3 \\# 11  \ncost = 1.50 + 3.75 \\# 5.25  \ntotal = int(\"9\") + 1 \\# 10  \nStrings  \ntitle = 'Us and them'  \n\\# most list operations work on strings  \ntitle[0] \\# 'U'  \nlen(title) \\# 11  \ntitle .split(' ') \\# ['Us', 'and', 'them']':' .join(['A','B','C']) \\# 'A:B:C'  \nnine = str(9) \\# convert int to string  \ntitle .replace('them', 'us') \\# Us and us  \nTuples  \nLike lists, except they cannot be changed tuple1 = (1,2,3,\"a\",\"z\") \\# Creates tuple  \ntuple1[3] \\# 'a'  \nDictionaries  \nvotes = {'red': 3, 'blue': 5}  \nvotes.keys() votes['gold'] = 4 del votes['gold'] votes['blue'] = 6 len(votes)  \nvotes.values()'green' in votes votes.has_key('red')  \n\\# ['blue', 'red']  \n\\# add a key/val  \n\\# deletes key  \n\\# change value \\# 2  \n\\# [6, 3]  \n\\# False  \n\\# True  \nFor Loops  \ngrades = ['A', 'C', 'B', 'F']  \nfor grade in grades: \\# iterate over all vals  \nprint (grade)  \nfor k,v in enumerate(grades): \\# using key value pair if v=='F':  \ngrades[k]='A' \\# change all Fs to As  \nWhile Loops  \ni = 0  \nwhile True: i += 1  \nif i == 3:  \ncontinue \\# go to next loop if i == 7:  \nbreak \\# end loop  \nprint(i) \\# 1 2 4 5 6  \ninv = {'apples': 7, 'peaches': 4}  \nfor fruit, count in inv .items(): \\# using dictionaries print(\"We have {} {}\" .format(count, fruit))  \nfor i in range(10): \\# 0 to 9 counting by 1s  \nfor i in range(5, 10): \\# 5 to 9 counting by 1s for i in range(9, 2, -1): \\# 9 to 3 decreasing by 1s  \nFunctions  \ndef sumNums(numOne, numTwo = 0): return numOne + numTwo  \nprint(sumNums(3,4)) \\# 7  \nprint(sumNums(3)) \\# 3","cbCaiiJzMrgMKDFd","https://ap.wps.com/l/cbCaiiJzMrgMKDFd","pdf",63936,"English","# General Information\n## Comments and Output\n## Conditional Statements\n## Lists\n## Tuples\n## Dictionaries\n## For Loops\n## While Loops\n## Functions","[{\"question\":\"How do conditional statements work in this Python cheat sheet?\",\"answer\":\"It uses if/elif/else with boolean conditions, including comparisons and logical operators such as and/or/not. Examples show branching for weather and job matching.\"},{\"question\":\"What list operations are demonstrated?\",\"answer\":\"The sheet includes indexing and slicing, len, count, sort, remove, append, pop, and membership tests like 75 in scores. It also shows how sorting changes element order.\"},{\"question\":\"How are loops and functions illustrated?\",\"answer\":\"For loops iterate with enumerate and range, while while loops use continue and break to control flow. Functions are defined with def, can include default parameters, and return values from simple expressions.\"}]","Python - Cheat Sheet - Quick reference | PDF",1791923586]