[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-571392-105":3,"detail-sidebar-cat-1-en-105":85,"doc-detail-571392-en":131},{"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":78,"head_meta":80,"extra_data":82,"updated_unix":84},105,"en","python-3-cheatsheet-the-basics-read-online-free","Python 3 cheatsheet - the basics - read online free","","Quick reference for Python 3 fundamentals focused on interacting with users, working with variables, and printing text and mixed-type values. Covers converting input to strings and integers, branching with if/else and lexicographic string comparison, plus core string operations like case conversion, membership tests, counting, replacing, and length. Includes list/string iteration and range-based loops, repeat patterns, and a complete Celsius-to-Fahrenheit example using arithmetic and formatted output.",{"@graph":14,"@context":77},[15,34,56],{"@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/template/","Template",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/template/general/","General",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/python-3-cheatsheet-the-basics-read-online-free/571392/",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/python-3-cheatsheet-the-basics-read-online-free/571392.png","ImageObject",442,249,{"name":42,"@type":43},"Hazel","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-23","2026-10-13",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",7,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69,73],{"name":60,"@type":61,"acceptedAnswer":62},"What Python built-ins are used for user input and output in the cheatsheet?","Question",{"text":63,"@type":64},"The cheatsheet uses input() to collect user text and print() to display results, including printing multiple values in one statement.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How does the cheatsheet compare strings to choose between options?",{"text":68,"@type":64},"It shows if/else with comparisons like if msg == 'hello' and lexicographic ordering such as if msg \u003C 'n', based on character-by-character comparison.",{"name":70,"@type":61,"acceptedAnswer":71},"Which string methods and operations are summarized?",{"text":72,"@type":64},"It includes upper()/lower()/title() for case changes, membership tests like 'e' in msg, count() for occurrences, replace() for substitution, islower()/isupper()/istitle() for casing checks, and len() for length.",{"name":74,"@type":61,"acceptedAnswer":75},"How are loops and ranges used to repeat actions?",{"text":76,"@type":64},"It demonstrates for loops with range(10), range(1, 11), descending ranges, step sizes like range(0, 11, 2), and iterating over characters in a string using for c in 'Hello'.","https://schema.org",{"og:url":32,"og:type":79,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":81,"canonical":32},"index,follow",{"doc_id":83,"site_id":7},571392,1792086790,{"code":4,"msg":86,"data":87},"success",[88,93,98,103,108,113,118,123,128],{"id":89,"doc_module":22,"doc_module_name":25,"category_name":90,"show_sort_weight":91,"slug":92},11,"Presentations",90,"presentations",{"id":94,"doc_module":22,"doc_module_name":25,"category_name":95,"show_sort_weight":96,"slug":97},12,"Resumes",80,"resumes",{"id":99,"doc_module":22,"doc_module_name":25,"category_name":100,"show_sort_weight":101,"slug":102},14,"Invoices",70,"invoices",{"id":104,"doc_module":22,"doc_module_name":25,"category_name":105,"show_sort_weight":106,"slug":107},15,"Posters",60,"posters",{"id":109,"doc_module":22,"doc_module_name":25,"category_name":110,"show_sort_weight":111,"slug":112},16,"Social Media",50,"social-media",{"id":114,"doc_module":22,"doc_module_name":25,"category_name":115,"show_sort_weight":116,"slug":117},17,"Forms",40,"forms",{"id":119,"doc_module":22,"doc_module_name":25,"category_name":120,"show_sort_weight":121,"slug":122},18,"Letters",30,"letters",{"id":124,"doc_module":22,"doc_module_name":25,"category_name":125,"show_sort_weight":126,"slug":127},21,"Paper Templates",5,"papers-templates",{"id":129,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":4,"slug":130},158,"general-158",{"code":4,"msg":86,"data":132},{"doc_id":83,"user_id":133,"nickname":42,"user_avatar":134,"doc_module":22,"category_id":129,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":135,"file_id":136,"file_url":137,"file_type":138,"file_size":139,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":22,"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":144,"read_time":4},137441390410,"https://ap-avatar.wpscdn.com/avatar/2000252f4ab5702993?_k=1776741390130283984","Python 3 cheatsheet (the basics)  \nInteract with the user (input and output) Text (strings)  \nVariables  \nGROK  \nLEARNING  \nPrint a message  \nprint ( 'Hello, world!')  \nPrint multiple values (of different types)  \nndays = 365  \nprint ( 'There are' , ndays, 'in a year')  \nAsking the user for a string  \nname = input ( 'What is your name? ' )  \nAsking the user for a whole number (an integer)  \nnum = int (input( 'Enter a number: ' ))  \nDecide between options  \nString manipulation  \nCompare two strings  \nmsg = 'hello'  \nif msg == 'hello': print ('howdy')  \nLess than another string?  \nif msg \u003C 'n': print ('a-m')  \nelse:  \nprint ('n-z')  \n! strings are compared character at a time (lexicographic order)  \nIs a character in a string?  \n'e' in msg  \nIs a string in another string?  \n'ell' in msg  \nConvert to uppercase  \nmsg.upper()  \nalso lower and title Count a character in a string  \nmsg.count('l')  \nReplace a character or string  \nmsg. replace( 'l' , 'X')  \nDelete a character or string  \nmsg. replace( 'l' , '' )  \nIs the string all lowercase?  \nmsg.islower()  \nalso isupper and istitle  \ns = [datetime. hs.insert(0, lamb  \nSingle quoted  \n'perfect'  \nDouble quoted  \n\"credit\"  \nMulti-line  \n'''Hello, World!'''  \nAdd (concatenate) strings  \n'Hello' + 'World'  \nMultiply string by integer  \n'Echo . . . ' *4  \nLength of a string  \nlen ('Hello')  \nConvert string to integer  \nint ('365')  \nCreating a variable  \ncelsius = 25  \nUsing a variable  \ncelsius*9/5 + 32  \nWhole numbers (integers)  \nAddition and subtraction  \n365 + 1 - 2  \nMultiplication and division  \n25*9/5 + 32  \nPowers (2 to the power of 8)  \n2**8  \nConvert integer to string  \nstr(365)  \nRepeat a block (a fixed number of times)  \nRepeat a block 10 times  \nfor i in range(10): print(i)  \nSum the numbers 0 to 9  \ntotal = 0  \nfor i in range(10):  \ntotal = total + i print(total)   \nRepeat a block over a string  \nfor c in 'Hello': print(c)  \nKeep printing on one line  \nfor c in 'Hello':  \nprint(c, end= ' ' ) print ('!')  \nCount from 0 to 9  \nrange(10)  \n! range starts from 0 and goes up to, but not including, 10  \nCount from 1 to 10  \nrange(1, 11)  \nCount from 10 down to 1  \nrange(10, 0, -1)  \nCount 2 at a time to 10  \nrange(0, 11, 2)  \nCountdown 2 at a time  \nrange(10, 0, -2)  \nRepeat a block over list (or string) indices  \nmsg = 'I grok Python!'for i in range (len(msg)):  \nprint(i, msg[i])  \nPutting it together: Celsius to Fahrenheit converter  \nAsk the user for a temperature in degrees Celsius  \ncelsius = int (input( 'Temp . in Celsius: ' ))  \nCalculate the conversion  \nfahrenheit = celsius*9/5 + 32  \nOutput the result  \nprint(farenheit, 'Fahrenheit')  \nLearn more in [Intro. to Programming](Intro. to Programming @ groklearning.com)[ @ groklearning.com](Intro. to Programming @ groklearning.com)","cbCaimirgtPZUuXT","https://ap.wps.com/l/cbCaimirgtPZUuXT","pdf",127788,"English","# Interacting with the user\n# Variables and printing\n# String basics and manipulation\n# Decision making with if/else\n# Loops and iteration\n# Putting it together: Celsius to Fahrenheit converter","[{\"question\":\"What Python built-ins are used for user input and output in the cheatsheet?\",\"answer\":\"The cheatsheet uses input() to collect user text and print() to display results, including printing multiple values in one statement.\"},{\"question\":\"How does the cheatsheet compare strings to choose between options?\",\"answer\":\"It shows if/else with comparisons like if msg == 'hello' and lexicographic ordering such as if msg \\u003c 'n', based on character-by-character comparison.\"},{\"question\":\"Which string methods and operations are summarized?\",\"answer\":\"It includes upper()/lower()/title() for case changes, membership tests like 'e' in msg, count() for occurrences, replace() for substitution, islower()/isupper()/istitle() for casing checks, and len() for length.\"},{\"question\":\"How are loops and ranges used to repeat actions?\",\"answer\":\"It demonstrates for loops with range(10), range(1, 11), descending ranges, step sizes like range(0, 11, 2), and iterating over characters in a string using for c in 'Hello'.\"}]","Python 3 cheatsheet - the basics - read online free | PDF",1791914953]