Transcription of Python Basics: A Practical Introduction to Python 3
1 PythonBasics: APracticalIntroductiontoPython3 RealPythonPythonBasics: APracticalIntroductiontoPython3 RevisedandUpdated4thEditionDavidAmos,Dan Bader,JoannaJablonski,FletcherHeislerCop yright RealPython( ),2012 2020 Foronlineinformationandorderingofthisand otherbooksbyRealPython, please For more information, Python and the Python logos are trademarks or registered trade-marksofthePythonSoftwareFoundation , Thisebookislicensedforyourpersonalenjoym entonly. Thisebookmaynotberesoldorgivenawaytoothe rpeople. Ifyouwouldliketosharethisbookwithanother per-son, pleasepurchaseanadditionalcopyforeachrec ipient. Ifyou rereadingthisbookanddidnotpurchaseit,ori fitwasnotpurchasedforyour use only, then please return PythonBasics: APracticalIntroductiontoPython3 Withthefullversionofthebookyougetacomple tePythoncurriculumtogoallthewayfrombegin nertointermediate-level.
2 Everystepalongthewayisexplainedandillust ratedwithshort& a fluent Pythonista and gain programming knowledge youcanapplyinthereal-world, :APracticalIn-troductiontoPython3 Ilove[thebook]! Thewordingiscasual, easytounderstand, andmakestheinformationр ,andit snottoodensesoit velookedatover10diоerentPythontutorials/ books/onlinecourses,andI veprobablylearnedthemostfromRealPython! ThomasWong ThreeyearslaterandIstillreturntomyRealPy thonbookswhenIneedaquickrefresheronusage ofvitalPythoncommands. RobFowler Iр , step-by-stepinstructionsbreakthebigconce ptsdown into bite-sized chunks written in plain English. The mupandrunningnow,butIconstantlyrefertoth ematerialforguidance. JaredNielsen рectsmysavingsaccount neat! DrewPrescott AsapracticeofwhatyoutaughtIstartedbuildi ngsimplescriptsforpeopleonmyteamtohelpth emintheireverydayduties.
3 Whenmymanagersnoticedthat,Iwasoо ,butIп :MANYTHANKS! Kamil ,inanydisciplinereally,requirethelearnin gofalotofjargonwheninfactwhatisbeingtaug htcouldbetaughtquicklyandsuccinctlywitho uttoomuchofit. Thecoursesdoaverygoodjobofkeepingtheexam plesinteresting. StephenGrady Afterreadingtheп пvehoursnowtakeslessthantenminutes! BrandonYoungdale Honestly,throughoutthiswholeprocesswhatI foundwasjustmelookingreallyhardforthings thatcouldmaybebeaddedorimproved,butthist utorialisamazing!Youdoawonderfuljobofexp lainingandteachingPythoninawaythatpeople likeme,acompletenovice, р пnishupthebook. пcialtomeinthefuture! SheaKlusewicz TheauthorsofthecourseshaveNOTforgottenwh atitisliketobeabeginner somethingthatmanyauthorsdo andassumenoth-ingabouttheirreaders, , the only ones I have actually пnished cover to cover, and theyarehandsdownthebestonthemarket.
4 Iflikeme,you renotapro-grammer(Iworkinonlinemarketing )you llпndthesecoursestobelikeamentorduetothe clear,рuо-freeexplanations! Highlyrecom-mended! CraigAddymanAbouttheAuthorsAtRealPythony ou launched in 2012 and currently helpsmore than three million Python developers each month with Herearethemem-bersoftheRealPythontutoria lteamwhoworkedonPythonBasics:DavidAmosis thecontenttechnicalleadforRealPython. Afterleav-ingacademiain2015,Davidworkedi nvarioustechnicalpositionsasaprogrammera nddatascientist. In2019,DavidjoinedRealPythonfulltimetopu rsuehispassionforeducation. developer of the learning platform. Dan hasbeen writing code for more than twenty years and holds a master sdegreeincomputerscience. He stheauthorofPythonTricks, ,patterns,andpeskylittledetailsledhertof ollowacareerintranslation.
5 Itwasonlyamatteroftimebeforeshewouldfall inlovewithanewlanguage: Python ! Heisleris the founder of Hunter2, where he teaches de-velopers how to hack and secure modern web apps. As one of thefoundingmembersofRealPython, WhyThisBook? .. AboutRealPython .. HowtoUseThisBook .. BonusMaterialandLearningResources .. 252 ANoteonPythonVersions .. Windows .. macOS .. UbuntuLinux .. 373 WriteaPythonProgram .. MessThingsUp .. CreateaVariable .. InspectValuesintheInteractiveWindow .. LeaveYourselfHelpfulNotes .. SummaryandAdditionalResources .. 604 WhatIsaString? .. Concatenation,Indexing,andSlicing .. ManipulateStringsWithMethods .. InteractWithUserInput .. Challenge: PickApartYourUser sInput.
6 WorkingWithStringsandNumbers .. StreamlineYourPrintStatements .. FindaStringinaString .. Challenge: TurnYourUserIntoaL33tH4x0r .. SummaryandAdditionalResources .. 1005 IntegersandFloating-PointNumbers .. ArithmeticOperatorsandExpressions .. Challenge: PerformCalculationsonUserInput .. MakePythonLietoYou .. MathFunctionsandNumberMethods .. PrintNumbersinStyle .. ComplexNumbers .. SummaryandAdditionalResources .. 1306 WhatIsaFunction,Really? .. WriteYourOwnFunctions .. Challenge: ConvertTemperatures .. RuninCircles .. Challenge: TrackYourInvestments.. UnderstandScopeinPython .. SummaryandAdditionalResources .. 1627 UsetheDebugControlWindow .. SquashSomeBugs .. SummaryandAdditionalResources.
7 1798 CompareValues .. AddSomeLogic .. ControltheFlowofYourProgram .. Challenge: FindtheFactorsofaNumber .. BreakOutofthePattern .. RecoverFromErrors .. SimulateEventsandCalculateProbabilities .. Challenge: SimulateaCoinTossExperiment .. Challenge: SimulateanElection .. SummaryandAdditionalResources .. 2249 Tuples,Lists, TuplesAreImmutableSequences .. ListsAreMutableSequences .. Nesting,Copying,andSortingTuplesandLists .. Challenge: Listoflists .. Challenge: WaxPoetic .. StoreRelationshipsinDictionaries .. Challenge: CapitalCityLoop .. HowtoPickaDataStructure .. Challenge: CatsWithHats .. SummaryandAdditionalResources .. 27410 Object-OrientedProgramming(OOP) DefineaClass .. InstantiateanObject.
8 InheritFromOtherClasses .. Challenge: ModelaFarm .. SummaryandAdditionalResources .. 29711 WorkingWithModules .. WorkingWithPackages .. SummaryandAdditionalResources .. 31812 FilesandtheFileSystem .. WorkingWithFilePathsinPython .. CommonFileSystemOperations .. Challenge: MoveAllImageFilestoaNewDirectory . ReadingandWritingFiles .. ReadandWriteCSVData .. Challenge: CreateaHighScoresList .. SummaryandAdditionalResources .. 37813 InstallingThird-PartyPackagesWithpip.. ThePitfallsofThird-PartyPackages .. SummaryandAdditionalResources .. 39214 ExtractingTextFromaPDF .. ExtractingPagesFromaPDF .. Challenge:PdfFileSplitterClass .. ConcatenatingandMergingPDFs .. RotatingandCroppingPDFP ages.
9 EncryptingandDecryptingPDFs .. Challenge: UnscrambleaPDF .. CreatingaPDFFileFromScratch .. SummaryandAdditionalResources .. 44015 AnIntroductiontoSQLite .. LibrariesforWorkingWithOtherSQLD atabases .. SummaryandAdditionalResources .. 45616 ScrapeandParseTextFromWebsites .. UseanHTMLP arsertoScrapeWebsites .. InteractWithHTMLF orms .. InteractWithWebsitesinRealTime .. SummaryandAdditionalResources .. 48517 Scientiр UseNumPyforMatrixManipulation .. UseMatplotlibforPlottingGraphs .. SummaryandAdditionalResources .. 52211 Contents18 AddGUIE lementsWithEasyGUI .. ExampleApp: PDFPageRotator .. Challenge: PDFPageExtractionApplication .. IntroductiontoTkinter .. WorkingWithWidgets .. ControllingLayoutWithGeometryManagers.
10 MakingYourApplicationsInteractive .. ExampleApp: TemperatureConverter .. ExampleApp: TextEditor .. : ReturnofthePoet .. SummaryandAdditionalResources .. 61819 FreeWeeklyTipsforPythonDevelopers .. PythonTricks: TheBook .. RealPythonVideoCourseLibrary .. Acknowledgements .. 62412 ForewordHello, and welcome toPython Basics: A Practical Introduction toPython3. Ihopeyou rereadytolearnwhysomanyprofessionalandho bbyist developers are drawn to Python and how you can beginusingitonyourownprojects,smallandla rge, thaveacomputersciencedegree,don tworry. David,Dan,Joanna, and Fletcher will guide you through the important comput-ingconceptswhileteachingyouthePyt honbasicsand,justasimpor-tantly, ,youdon tyethavetheexperiencetojudgehowwellitwil lserveyouinthelongrun.