id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
2,200 | arguments are assigned to the named local variables in function body see the calls section for the rules governing this assignment syntacticallyany expression can be used to represent an argumentthe evaluated value is assigned to the local variable see also the parameter glossary entrythe faq question on the difference... |
2,201 | bytecode python source code is compiled into bytecodethe internal representation of python program in the cpython interpreter the bytecode is also cached in pyc files so that executing the same file is faster the second time (recompilation from source to bytecode can be avoidedthis "intermediate languageis said to run ... |
2,202 | (continued from previous page@staticmethod def )the same concept exists for classesbut is less commonly used there see the documentation for function definitions and class definitions for more about decorators descriptor any object which defines the methods __get__()__set__()or __delete__(when class attribute is descri... |
2,203 | open(function file-like object synonym for file object finder an object that tries to find the loader for module that is being imported since python there are two types of findermeta path finders for use with sys meta_pathand path entry finders for use with sys path_hooks see pep pep and pep for much more detail floor ... |
2,204 | generic function function composed of multiple functions implementing the same operation for different types which implementation should be used during call is determined by the dispatch algorithm see also the single dispatch glossary entrythe functools singledispatch(decoratorand pep gil see global interpreter lock gl... |
2,205 | have shorter development/debug cycle than compiled onesthough their programs generally also run more slowly see also interactive interpreter shutdown when asked to shut downthe python interpreter enters special phase where it gradually releases all allocated resourcessuch as modules and various critical internal struct... |
2,206 | in multi-threaded environmentthe lbyl approach can risk introducing race condition between "the lookingand "the leapingfor examplethe codeif key in mappingreturn mapping[keycan fail if another thread removes key from mapping after the testbut before the lookup this issue can be solved with locks or by using the eafp ap... |
2,207 | namespace the place where variable is stored namespaces are implemented as dictionaries there are the localglobal and built-in namespaces as well as nested namespaces in objects (in methodsnamespaces support modularity by preventing naming conflicts for instancethe functions builtins open and os open(are distinguished ... |
2,208 | see also the argument glossary entrythe faq question on the difference between arguments and parametersthe inspect parameter classthe function sectionand pep path entry single location on the import path which the path based finder consults to find modules for importing path entry finder finder returned by callable on ... |
2,209 | as opposed to the cleanerpythonic methodfor piece in foodprint(piecequalified name dotted name showing the "pathfrom module' global scope to classfunction or method defined in that moduleas defined in pep for top-level functions and classesthe qualified name is the same as the object' nameclass cclass ddef meth(self)pa... |
2,210 | special method method that is called implicitly by python to execute certain operation on typesuch as addition such methods have names starting and ending with double underscores special methods are documented in specialnames statement statement is part of suite ( "blockof codea statement is either an expression or one... |
2,211 | macintosh convention '\rsee pep and pep as well as bytes splitlines(for an additional use variable annotation an annotation of variable or class attribute when annotating variable or class attributeassignment is optionalclass cfield'annotationvariable annotations are usually used for type hintsfor example this variable... |
2,212 | appendix glossary |
2,213 | about these documents these documents are generated from restructuredtext sources by sphinxa document processor specifically written for the python documentation development of the documentation and its toolchain is an entirely volunteer effortjust like python itself if you want to contributeplease take look at the rep... |
2,214 | appendix about these documents |
2,215 | history and license history of the software python was created in the early by guido van rossum at stichting mathematisch centrum (cwisee principal authoralthough it includes many contributions from others in guido continued his work on python at the corporation for national research initiatives (cnrisee in may guido a... |
2,216 | terms and conditions for accessing or otherwise using python psf license agreement for python this license agreement is between the python software foundation ("psf")and the individual or organization ("licensee"accessing and otherwise using python software in source or binary form and its associated documentation subj... |
2,217 | (continued from previous page("licensee"accessing and otherwise using this software in source or binary form and its associated documentation ("the software" subject to the terms and conditions of this beopen python license agreementbeopen hereby grants licensee non-exclusiveroyalty-freeworld-wide license to reproducea... |
2,218 | (continued from previous pageagreement this agreement together with python may be located on the internet using the following uniquepersistent identifier (known as handle)this agreement may also be obtained from proxy server on the internet using the following url in the event licensee prepares derivative work that is ... |
2,219 | (continued from previous pagestichting mathematisch centrum disclaims all warranties with regard to this softwareincluding all implied warranties of merchantability and fitnessin no event shall stichting mathematisch centrum be liable for any specialindirect or consequential damages or any damages whatsoever resulting ... |
2,220 | (continued from previous pagesoftwareeven if advised of the possibility of such damage any feedback is very welcome emailm-mat math sci hiroshima- ac jp (remove spacec sockets the socket module uses the functionsgetaddrinfo()and getnameinfo()which are coded in separate source files from the wide projectcopyright ( and ... |
2,221 | (continued from previous pagedistribution of the software without specificwritten prior permission sam rushing disclaims all warranties with regard to this softwareincluding all implied warranties of merchantability and fitnessin no event shall sam rushing be liable for any specialindirect or consequential damages or a... |
2,222 | (continued from previous pagecopyright - automatrixinc all rights reserved authorskip montanaro copyright - stichting mathematisch centrumall rights reserved permission to usecopymodifyand distribute this python software and its associated documentation for any purpose without fee is hereby grantedprovided that the abo... |
2,223 | (continued from previous pageassociated documentationyou agree that you have readunderstoodand will comply with the following terms and conditionspermission to usecopymodifyand distribute this software and its associated documentation for any purpose and without fee is hereby grantedprovided that the above copyright no... |
2,224 | (continued from previous pageredistribution and use in source and binary formswith or without modificationare permitted provided that the following conditions are met redistributions of source code must retain the above copyright noticethis list of conditions and the following disclaimer redistributions in binary form ... |
2,225 | /***************************************************************the author of this software is david gay copyright ( by lucent technologies permission to usecopymodifyand distribute this software for any purpose without fee is hereby grantedprovided that this entire notice is included in all copies of any software whic... |
2,226 | (continued from previous page the names "openssl toolkitand "openssl projectmust not be used to endorse or promote products derived from this software without prior written permission for written permissionplease contact openssl-core@openssl org products derived from this software may not be called "opensslnor may "ope... |
2,227 | (continued from previous pagethis can be in the form of textual message at program startup or in documentation (online or textualprovided with the package redistribution and use in source and binary formswith or without modificationare permitted provided that the following conditions are met redistributions of source c... |
2,228 | (continued from previous pagethe above copyright notice and this permission notice shall be included in all copies or substantial portions of the software the software is provided "as is"without warranty of any kindexpress or impliedincluding but not limited to the warranties of merchantabilityfitness for particular pu... |
2,229 | (continued from previous page the origin of this software must not be misrepresentedyou must not claim that you wrote the original software if you use this software in productan acknowledgment in the product documentation would be appreciated but is not required altered source versions must be plainly marked as suchand... |
2,230 | libmpdec the _decimal module is built using an included copy of the libmpdec library unless the build is configured --with-system-libmpdeccopyright ( - stefan krah all rights reserved redistribution and use in source and binary formswith or without modificationare permitted provided that the following conditions are me... |
2,231 | revised and updated th edition david amosdan baderjoanna jablonskifletcher heisler copyright (creal python (realpython com) - for online information and ordering of this and other books by real pythonplease visit realpython com for more informationplease contact us at info@realpython com isbn (paperbackisbn (electronic... |
2,232 | introduction to python with the full version of the book you get complete python curriculum to go all the way from beginner to intermediate-level every step along the way is explained and illustrated with short clear code samples coding exercises within each and our interactive quizzes help fast-track your progress and... |
2,233 | " love [the book]the wording is casualeasy to understandand makes the information ow well never feel lost in the materialand it' not too dense so it' easy for me to review older over and over 've looked at over di erent python tutorials/books/online coursesand 've probably learned the most from real python!-thomas wong... |
2,234 | real world and interesting challenges just built savings estimator that actually re ects my savings account neat!-drew prescott "as practice of what you taught started building simple scripts for people on my team to help them in their everyday duties when my managers noticed thati was ered new position as developer kn... |
2,235 | looking really hard for things that could maybe be added or improvedbut this tutorial is amazingyou do wonderful job of explaining and teaching python in way that people like mea complete novicecould really grasp the ow of the lessons works perfectly throughout the exercises truly helped along the way and you feel very... |
2,236 | at real python you'll learn real-world programming skills from community of professional pythonistas from all around the world the realpython com website launched in and currently helps more than three million python developers each month with free programming tutorials and in-depth learning resources everyone who work... |
2,237 | contents foreword introduction why this book about real python how to use this book bonus material and learning resources your first python program write python program mess things up create variable inspect values in the interactive window leave yourself helpful notes summary and additional resources setting up python... |
2,238 | manipulate strings with methods interact with user input challengepick apart your user' input working with strings and numbers streamline your print statements find string in string challengeturn your user into summary and additional resources numbers and math integers and floating-point numbers arithmetic operators an... |
2,239 | challengefind the factors of number break out of the pattern recover from errors simulate events and calculate probabilities challengesimulate coin toss experiment challengesimulate an election summary and additional resources object-oriented programming (oop define class instantiate an object inherit from other classe... |
2,240 | reading and writing files read and write csv data challengecreate high scores list summary and additional resources installing packages with pip installing third-party packages with pip the pitfalls of third-party packages summary and additional resources working with databases an introduction to sqlite libraries for w... |
2,241 | graphical user interfaces add gui elements with easygui example apppdf page rotator challengepdf page extraction application introduction to tkinter working with widgets controlling layout with geometry managers making your applications interactive example apptemperature converter example apptext editor challengereturn... |
2,242 | helloand welcome to python basicsa practical introduction to python hope you're ready to learn why so many professional and hobbyist developers are drawn to python and how you can begin using it on your own projectssmall and largeright away this book is targeted at beginners who either know little programming but not t... |
2,243 | ple programsbut you cannot build professional applications with it name one fortune company that powers its core business logic with scratch come up emptyme toobecause that would be insanity other languages are incredibly powerful for expert developers the most popular one in this category is likely +and its close rela... |
2,244 | pythonon the other handis special it is full-spectrum language we often judge the simplicity of language based on the helloworld test that iswhat syntax and actions are necessary to get the language to output helloworld to the userin pythonit couldn' be simplerprint("helloworld"that' ithoweveri find this an unsatisfyin... |
2,245 | so there you have simple yet powerful starter example on the realworld side of thingsmany incredible applications have been written in python as well youtubethe world' most popular video streaming siteis written in python and processes more than million requests per second instagram is another example of python applica... |
2,246 | python to the other likely candidates you could pick to learn programmingyou'll see one is unlike the othersyou can explore this chart and create similar charts to this one over at insights stackoverflow com/trends notice the incredible growth of python compared to the flat or even downward trend of the other usual can... |
2,247 | againin the graph belowyou'll see that python is topping the charts and is well above even second placeif you agree with me that the relative popularity of programming language mattersthen python is clearly good choice we don' need you to be computer scientist one other point that want to emphasize as you start your py... |
2,248 | ually python skills can take your biology power and amplify it well beyond your colleaguesto make it your superpower dan and real python finallylet me leave you with comment on your authors dan bader and the other real python authors work day in and day out to bring clear and powerful explanations of python concepts to... |
2,249 | introduction welcome to real python' python basics bookfully updated for python in this bookyou'll learn real-world python programming techniquesillustrated with useful and interesting examples whether you're new programmer or professional software developer looking to dive into new languagethis book will teach you all... |
2,250 | python was built to be easier to use than other programming languages it' usually much easier to read python code and much faster to write code in python than in other languages for instancehere' some basic code written in canother commonly used programming language#include int main(voidprintf("helloworld\ ")all the pr... |
2,251 | you may be asking yourselfwhat should learn about python in the beginning to get strong foundationif sothen this book is for youno matter if you're complete beginner or if you've already dabbled in python or other languages python basics is written in plain english and breaks down the core concepts that you really need... |
2,252 | once you've mastered the material in this bookyou will have gained strong enough foundation that venturing out on your own into more advanced territory will be breeze what you'll learn here is based on the first part of the original real python course initially released in over the yearsthis python curriculum has been ... |
2,253 | how to use this book how to use this book the first half of this book is quick but thorough overview of all the python fundamentals you don' need any prior experience with programming to get started the second half is focused on finding practical solutions to interestingreal-world coding problems if you're beginnerthen... |
2,254 | learning by doing this book is all about learning by doingso be sure to actually type in the code snippets you encounter in the book for best resultswe recommend that you avoid copying and pasting the code examples you'll learn the concepts better and pick up the syntax faster if you type out each line of code yourself... |
2,255 | interactive quizzes most in this book come with free online quiz to check your learning progress you can access the quizzes using the links provided at the end of the the quizzes are hosted on the real python website and can be viewed on your phone or computer each quiz takes you through series of questions related to ... |
2,256 | example code license the example python scripts associated with this book are licensed under creative commons public domain (cc license this means that you're welcome to use any portion of the code for any purpose in your own programs formatting conventions code blocks will be used to present example codethis is python... |
2,257 | feedback and errata we welcome ideassuggestionsfeedbackand the occasional rant did you find topic confusingdid you find an error in the text or codedid we leave out topic that you' love to know more aboutwe're always looking to improve our teaching materials whatever the reasonplease send in your feedback at the link b... |
2,258 | setting up python this book is about programming computers with python you could read this book from cover to cover without ever touching keyboardbut you' miss out on the fun part--codingto get the most out of this bookyou need computer with python installed on it and way to createeditand save python code files in this... |
2,259 | note on python versions note on python versions many operating systemsincluding macos and linuxcome with python preinstalled the version of python that comes with your operating system is called the system python the system python is used by your operating system and is usually out of date it' essential that you have t... |
2,260 | windows follow these steps to install python and open idle on windows important the code in this book is tested only against python installed as described in this section be aware that if you have installed python through some other meanssuch as anaconda pythonyou may encounter problems when running some of the code ex... |
2,261 | step run the installer open your downloads folder in windows explorer and double-click the file to run the installer dialog that looks like the following one will appearit' okay if the python version you see is greater than as long as the version is not less than important make sure you select the box that says add pyt... |
2,262 | open idle you can open idle in two steps click the start menu and locate the python folder open the folder and select idle (python idle opens python shell in new window the python shell is an interactive environment that allows you to type in python code and execute it immediately it' great way to get started with pyth... |
2,263 | the symbol that you see is called prompt whenever you see thisit means that python is waiting for you to give it some instructions interactive quiz this comes with free online quiz to check your learning progress you can access the quiz using your phone or computer at the following web addressrealpython com/quizzes/pyb... |
2,264 | click latest python release python located beneath the "python releases for mac os xheading near the top of the page as of this writingthe latest version was python then scroll to the bottom of the page and click macos -bit installer to start the download step run the installer open finder and double-click the download... |
2,265 | when the installer is finished copying filesclick close to close the installer window open idle you can open idle in three steps open finder and click applications double-click the python folder double-click the idle icon idle opens python shell in new window the python shell is an interactive environment that allows y... |
2,266 | at the top of the windowyou can see the version of python that is running and some information about the operating system if you see version less than then you may need to revisit the installation instructions in the previous section the symbol that you see is called prompt whenever you see thisit means that python is ... |
2,267 | install python there' good chance that your ubuntu distribution already has python installedbut it probably won' be the latest versionand it may be python instead of python to find out what version(syou haveopen terminal window and try the following commandspython --version python --version one or more of these command... |
2,268 | ubuntu or greater ubuntu version does not come with python by defaultbut it is in the universe repository you can install it with the following commands in the terminal applicationsudo apt-get update sudo apt-get install python idle-python python -pip note that because the universe repository is usually behind the pyth... |
2,269 | on some linux installationsyou can open idle with the following shortened commandidle idle opens python shell in new window the python shell is an interactive environment that allows you to type in python code and execute it immediately it' great way to get started with pythonnote while you're free to use code editor o... |
2,270 | important if you open idle with the idle command and see version less than displayed in the python shell windowthen you'll need to open idle with the idle-python command the symbol that you see in the idle window is called prompt whenever you see thisit means that python is waiting for you to give it some instructions ... |
2,271 | your first python program now that you have the latest version of python installed on your computerit' time to start codingin this you willwrite your first python program learn what happens when you run program with an error learn how to declare variable and inspect its value learn how to write comments ready to begin ... |
2,272 | write python program write python program if you don' already have idle openthen go ahead and open it there are two main windows that you'll work with in idlethe interactive windowwhich is the one that opens when you start idleand the editor window you can type code into both the interactive window and the editor windo... |
2,273 | go ahead and type at the prompt and press enter python evaluates the expressiondisplays the result ( )then displays another prompt every time you run some code in the interactive windowa new prompt appears directly below the result executing python in the interactive window can be described as loop with three steps pyt... |
2,274 | function is code that performs some task and can be invoked by name the above code invokesor callsthe print(function with the text "helloworldas input the parentheses tell python to call the print(function they also enclose everything that gets sent to the function as input the quotation marks indicate that "helloworld... |
2,275 | in the editor windowtype in the same code you used to print "helloworldin the interactive windowprint("helloworld"idle highlights code typed into the editor window just like in the interactive window important when you write code in python fileyou don' need to include the prompt before you run your programyou need to s... |
2,276 | every time you run code from fileyou'll see something like the following output in the interactive window==================restart ==================idle restarts the python interpreterwhich is the computer program that actually executes your codeevery time you run file this makes sure that programs are executed the sa... |
2,277 | syntax errors syntax error occurs when you write code that isn' allowed in the python language let' create syntax error by removing the last quotation mark from the code in the hello_world py file that you created in the last sectionprint("helloworldsave the file and press to run it the code won' runidle displays an al... |
2,278 | print(helloworlddid you notice how the text color changed to black when you removed the quotation marksidle no longer recognizes helloworld as text what do you think will happen when you run the programpress to find outthe following text displays in red in the interactive windowtraceback (most recent call last)file "/h... |
2,279 | review exercises you can nd the solutions to these exercises and many other bonus resources online at realpython com/python-basics/resources write program that idle won' run because it has syntax error write program that crashes only while it' running because it has runtime error create variable in pythonvariables are ... |
2,280 | values are assigned to variable names using special symbol called the assignment operator (=the operator takes the value to the right of the operator and assigns it to the name on the left let' modify the hello_world py file from the previous section to assign some text in variable before printing it to the screengreet... |
2,281 | greeting "helloworldprint(greetingtraceback (most recent call last)file ""line in nameerrorname 'greetingis not defined if you have trouble with an example in this bookdouble-check that every character in your code--including spaces--matches the example exactly computers have no common senseso being almost correct isn'... |
2,282 | like and uand even chinesejapaneseand arabic symbols howevernot every system can display decorated charactersso it' good idea to avoid them if you're going to share your code with people in different regions note you'll learn more about unicode in you can also read about python' support for unicode in the official pyth... |
2,283 | seconds is better name than because it provides more context but it still doesn' convey the full meaning of the code is the number of seconds it takes for process to finishor is it the length of moviethere' no way to tell the following name leaves no doubt about what the code meansseconds_per_hour when you read the abo... |
2,284 | note pep stands for python enhancement proposal pep is design document used by the python community to propose new features to the language following the standards outlined in pep ensures that your python code is readable by most python programmers this makes sharing code and collaborating with other people easier for ... |
2,285 | now print the string assigned to greeting using the print(functionprint(greetinghelloworld can you spot the difference between the output displayed by using print(and the output displayed by just entering the variable name and pressing enter when you type the variable name greeting and press enter python prints the val... |
2,286 | hereyou assign the number to both using print(xand inspecting display output without quotation marks because is number and not text in most casesthoughvariable inspection gives you more useful information than print(suppose you have two variablesxwhich is assigned the number and ywhich is assigned the string literal " ... |
2,287 | leave yourself helpful notes programmers sometimes read code they wrote while ago and wonder"what does this do?when you haven' looked at code in whileit can be difficult to remember why you wrote it the way you didto help avoid this problemyou can leave comments in your code comments are lines of text that don' affect ... |
2,288 | this is my first program it prints the phrase "helloworldthe comments are longer than the codegreeting "helloworldprint(greetingyou can also use comments to comment out code while you're testing program putting at the beginning of line of code lets you run your program as if that line of code didn' existbut it doesn' a... |
2,289 | the code and the symbolphrase "helloworldthis comment is pep compliant print(phrase)this comment isn' pep recommends that comments be used sparingly major pet peeve among programmers is comments that describe what is already obvious from reading the code for examplethe comment in the following code is unnecessaryprint ... |
2,290 | interactive quiz this comes with free online quiz to check your learning progress you can access the quiz using your phone or computer at the following web addressrealpython com/quizzes/pybasics-first-program additional resources to learn morecheck out the following resources" beginner tips for learning python programm... |
2,291 | strings and string methods many programmersregardless of their specialtydeal with text on daily basis for exampleweb developers work with text input from web forms data scientists process text to extract data and perform tasks like sentiment analysiswhich can help identify and classify opinions in body of text collecti... |
2,292 | what is string what is stringin you created the string "helloworldand printed it in idle' interactive window using print(in this sectionyou'll get deeper look into exactly what strings are and the various ways you can create them in python the string data type strings are one of the fundamental python data types the te... |
2,293 | note for nowyou can think of the word class as synonym for data typealthough it actually refers to something more specific you'll see just what class is in type(also works for values that have been assigned to variablephrase "helloworldtype(phrasestrings have three important properties strings contain individual letter... |
2,294 | note not every string is string literal sometimes strings are input by user or read from file since they're not typed out with quotation marks in your codethey're not string literals the quotes surrounding string are called delimiters because they tell python where string begins and where it ends when one type of quote... |
2,295 | note when you work on projectit' good idea to use only single quotes or only double quotes to delimit every string keep in mind that there really isn' right or wrong choicethe goal is to be consistent because consistency helps make your code easier to read and understand strings can contain any valid unicode character ... |
2,296 | multiline strings the pep style guide recommends that each line of python code contain no more than seventy-nine characters--including spaces note pep ' seventy-nine-character line length is recommendationnot rule some python programmers prefer slightly longer line length in this bookwe'll strictly follow pep ' recomme... |
2,297 | last line to be pep compliantthe total length of the lineincluding the backslashesmust be seventy-nine characters or fewer here' how you could write the paragraph as multiline string using the backslash methodparagraph "this planet has--or rather had-- problemwhich was thismost of the people living on it were unhappy f... |
2,298 | triple-quoted strings preserve whitespaceincluding newlines this means that running print(paragraphwould display the string on multiple linesjust as it appears in the string literal this may or may not be what you wantso you'll need to think about the desired output before you choose how to write multiline string to se... |
2,299 | in this sectionyou'll learn about three basic string operations concatenationwhich joins two strings together indexingwhich gets single character from string slicingwhich gets several characters from string at once let' dive instring concatenation you can combineor concatenatetwo strings using the operatorstring "abras... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.