It's called a virtualmachine, butit's almostlikehaving a computerinside a computer.
Anditexecutesthesewith a traditionalprogramminglanguage.
You'rewritingtext, and I'llswitchovertomycomputerhere.
Justthatwecouldmaybeframethisvisually a littlebitbetter, butnotchromeinvesco.
Bytheway, thisismytexteditorofchoicejust V s codeyouneedinordertowriteanysourcecode, somesortoftexteditorapplication, youcouldevenusesomethingliketextedit, forexample, if I pullittexteditonmyMac, it's notsurethatemailisthere, but I thinkthatmighthavebeenfromanotherstream.
Andwith a traditionallanguagethatconcludedBeforeyoudothiswiththehelpof a compiler, it'lltakethistextandtranslatingitinto, youknow, theybasicallybits, whichisthecomputer's nativesortoftongue.
Buthow's Pythondifferenthere?
Itisdifferentinthatitdoesn't actuallyperformthisstepexplicitlyalongthelineisstillactuallyhappens, butitbasicallytranslatesallthelinesthatyou'vewrittenwhenyoujustloadthescriptinto a programthatisitselfcalledPython.
Butif I typepipeonthreeandmycommandline, ifyouhaveitinstalled, youcanseethat I actuallyhavethissortofpromptherethesethreearrows, whichand I canactuallytypeininstructionsanditwillimmediatelyexecutethings.
Soit's bettergenerallytowriteyourprogramsinanactualtexteditorlikethe S codeorsublime, orAdamorsomethingelse, sothatyoucansaveyourcodeandlettheinterpreterrunitandrerunitagainandagain.
Sowhydon't wegoaheadanddothat?
Youwanttogoaheadandopenup a blankeditorwindow?
Soforthoseofyoufollowingalongathome, ifyouwanttogoaheadandGooglethe S codeorvisualstudiocode, you'rewelcometodownloadthesameprogramforfreeAdamSublimetextinnopadplusplusand a bunchofothersareverypopularonMacsandPCsandLennoxmachines.
Mainland, howwouldyougoaheadandpythonandjustwrite a programthatprintsoutliterallyHello, world?
I would I wouldusetheprintfunctionwhichcomeswithPython.
Andactually, thenicethingabout V s codeisthatitgivesyou a lotofthissortofbuiltinintelligence, dependingonhowyouliketodeveloporit'llactuallytellyouwhenyouwritefunctions, youknow, sortofwhatthefunctionofwhatthefunctionexpects, whatitdoes.
Sothisis a nicethingaboutmoderntexteditorsandintegrateddevelopmentenvironmentsuses.
Andisaid, Helloworld.
So I'm justgonnatypeinthestringHelloworldandthat's it.
So I'm alreadyrealizingthereisgonnabe a slightissuewiththis.
Sopleaseenteryourname.
Let's saymynameisColtonandtheprogramisover.
Nice.
Whichisexpected, Yeah.
I mean, youonlywantonelineofcodethatisaskinguserforinput, promptingthemfortheirnameandthenstoringthatvalueoverontheotherhand, sideoftheothersideinthenamevariable.
Sowhatdoyouwanttodonext?
Well, now, since I havenameactuallystoredsomewhere I'vesetnameequalsoragainstthevalueofinput, pleaseintoyourname.
I actuallyreusethatvariables, Aikensayprinthellospace.
So, Well, uh, we'regoingtogetthename, andthen I wanttobasicallychecktoseewhatthevalueofthenameisbecauseyousaidwewantthefrownonLeeappearwheneverit's meandotherwise.
Thisproblemwillgobackinandfixitinjust a minuteor 200 sets a feature, bytheway, thatno, that's a buckby.
Butlet's goaheadandbacktothecodeforjust a moment.
Well, folksproposedsolutionshere, perhaps, andthere's a fewquestions I had.
Forinstance, if I'm coming, a pythonknewwhat's withtheCoghlan's like I'm usedtotheindentation, buttheCoghlan's Whenwe'rethecurlybraces, thesothenicethingaboutPythonistherearenocurlybraces.
Butyouwouldinsteadofdoingsomethinglikethisandthenhaving, uhandactually, I'm not 100% sure.
I thinkthis, I think, technicallyisn't technicallypossibleto, youknow, it's not.
I'm gettingthatconflatedwith I thinksomethingelse, butyoudon't knowanotherstreamentirely, butmovingonyoudon't needthesethings.
Youyou'vedoneallyoujustneedtodoismakesurethisisindented a certainlevelwithinthisafterthesamestatementhereandwithoutopening a canofworms.
What's yourpreference?
Youliketabs?
Youlikespaces.
I liketabstheycouldconvertitintospaceisokay.
I'lltakethatasanacceptableanswer.
Indeed, inthePythoncommunity, unlikemostlanguages, thereisanacceptednorm, oratleast a recommendednorm, whichistousespaces.
Solet's putanendtothatdebatetoday.
We'regonnausespaces.
Fourspaceisgenerallywouldbeprettycommon, but I likethatYoudon't havetodothethecurlybraces, asyouknow, but I noticedyou'realsousingsinglequotes, and I feellikeindifferentlanguages.
Andeveninpython, I sometimesthesinglequotessometimesdoublequotes.
Howdo I thinkaboutthat?
Sotherearefortheforthelargepartinterchangeable.
Youcanmakestringswithdoublequotes.
Youcouldmakestringswithsinglequotes.
Now, ifyou'recomingfrom a backgroundlike C orJava, youcanonlyusedoublepointsforstrings.
Butyouhavetousesinglequotesforsinglecharacters.
Okay, Python.
There's nodifference.
Therearenothereisnotreally a bydefaultsinglecharacterversusstringwhenyou'reusing, youknow, thisapostrophecharacterorthedoublequotecharacter.
Sohowwouldpeoplegoaboutdecidingwhetheron a singlequotekindofpersonor a doublequotekindofperson?
I mean, I'm kindofgoingthroughanexistentialcrisis.
I'vebeenusingdoublequotesforlike 20 years, andfrankly, I'm tiredofholdingthisshiftdown, and I dothinkyou'reseeingandmoremodernLeepopularlanguagespythonandjavascriptamongthem.
I'm startingtoseefrankly, I thinksinglequotesmoreoften, butyougottobewarebecauseofthestupidgrammarissues, likeso I don't know.
Justbeconsistent.
I thinkisthepointorresorttooneortheotherwhenyouhavetocontextuallypersonallybigsinglequotes, soaswell.
I heardsomeoneproposedthatweuselower, soforcedthewholestringtolowercase.
I seeRichardproposedusinganarrayor a listinpythonwherewecouldcheckforlittleColtonorBigColtonOrralternatingcaps.
Colton, I thinkthedownsidethere's thatyou'regonnahaveinnerknowingnumberofpermutationsofColton's, ifyouwill, withtheseaiscapitalized, orthe O orthe L ormultipleonesandsoforth.
So I likethisloweridea.
Thisisactuallyprettyconventionalin a lotofprogramminglanguages, especiallypython.
ButessentiallyeverystringinPythonhas a seriesoffunctionsthatithasitsownreferencetoandthefunctionwhenyouwhenyoucallit, usingthisdotwhichessentiallymeansgoinsideofthethingtotheleftandthenexecutethisthingthatbelongstothatthingontheleft.
S o CanyougoaheadandfindusthedocumentationforthestirringclassescapitalizefunctionSowe'llgoto S t R, whichisthestringclassandpython a stringobjecttypeandweighwhatwentrighthere.
Let's say I haveColtonOgdenherein a string, and I wanttosplititintoitsconstituentsbecauseso I'lljustyougotsplit, whichisanothermethodinsideofthestringcloud.
So, forexample, inthiscase, L atindexzeroisApplewiseoneifit's thefirstelementbecause, uh, computerscientistsdecidedthatzeroishowtheyliketostartnumberingthings.
Itwasoriginallydesignedas a conflictlanguageforlesstechnicalpeoplewhoscratches a programmingenvironmentforpeoplethatarefreshprogrammingandcomputerscience.