id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
2,900 | will return the most recent threads in your gmail account you can pass an optional maxresults keyword argument to change this limitrecentthreads ezgmail recent(len(recentthreads recentthreads ezgmail recent(maxresults= len(recentthreads searching mail from gmail account in addition to using ezgmail unread(and ezgmail r... |
2,901 | you can also download all of them at once with downloadallattachments(by defaultezgmail saves attachments to the current working directorybut you can pass an additional downloadfolder keyword argument to downloadattachment(and downloadallattachments(as well for exampleimport ezgmail threads ezgmail search('vacation pho... |
2,902 | don' enter this example in the interactive shellit won' workbecause smtp example combob@example commy_secret_passwordand alice@example com are just placeholders this code is just an overview of the process of sending email with python import smtplib smtpobj smtplib smtp('smtp example com' smtpobj ehlo(( 'mx example com... |
2,903 | providercreate an smtp object by calling smptlib smtp()passing the domain name as string argumentand passing the port as an integer argument the smtp object represents connection to an smtp mail server and has methods for sending emails for examplethe following call creates an smtp object for connecting to an imaginary... |
2,904 | (using ssl)then encryption is already set upand you should skip this step here' an example of the starttls(method callsmtpobj starttls(( bready to start tls'the starttls(method puts your smtp connection in tls mode the in the return value tells you that the server is ready logging in to the smtp server once your encryp... |
2,905 | subject line of the email the '\nnewline character separates the subject line from the main body of the email the return value from sendmail(is dictionary there will be one keyvalue pair in the dictionary for each recipient for whom email delivery failed an empty dictionary means all recipients were successfully sent t... |
2,906 | imapobj select_folder('inbox'readonly=trueuids imapobj search(['since -jul- ']uids [ rawmessages imapobj fetch([ ]['body[]''flags']import pyzmail message pyzmail pyzmessage factory(rawmessages[ ][ 'body[]']message get_subject('hello!message get_addresses('from'[('edward snowden''esnowden@nsa gov')message get_addresses(... |
2,907 | imapclient(function to create an imapclient object most email providers require ssl encryptionso pass the ssl=true keyword argument enter the following into the interactive shell (using your provider' domain name)import imapclient imapobj imapclient imapclient('imap example com'ssl=truein all of the interactive shell e... |
2,908 | (('\\hasnochildren',)'/''inbox')(('\\hasnochildren',)'/''sent')--snip-(('\\hasnochildren''\\flagged')'/''starred')(('\\hasnochildren''\\trash')'/''trash')the three values in each of the tuples--for example(('\hasnochildren',)'/''inbox')--are as followsa tuple of the folder' flags (exactly what these flags represent is ... |
2,909 | search key meaning 'allreturns all messages in the folder you may run into imaplib size limits if you request all the messages in large folder see "size limitson page 'before date''on date''since datethese three search keys returnrespectivelymessages that were received by the imap server beforeonor after the given date... |
2,910 | imapobj search(['all']returns every message in the currently selected folder imapobj search(['on -jul- ']returns every message sent on july imapobj search(['since -jan- ''before -feb- ''unseen']returns every message sent in january that is unread (note that this means on and after january and up to but not including fe... |
2,911 | too much memory unfortunatelythe default size limit is often too small you can change this limit from , bytes to , , bytes by running this codeimport imaplib imaplib _maxline this should prevent this error message from coming up again you may want to make these two lines part of every imap program you write fetching an... |
2,912 | the raw messages returned from the fetch(method still aren' very useful to people who just want to read their email the pyzmail module parses these raw messages and returns them as pyzmessage objectswhich make the subjectbody"tofield"fromfieldand other sections of the email easily accessible to your python code continu... |
2,913 | method that returns the email' body as value of the bytes data type (the bytes data type is beyond the scope of this book but this still isn' string value that we can use ughthe last step is to call the decode(method on the bytes value returned by get_payload(the decode(method takes one argumentthe message' character e... |
2,914 | if there were no problems expunging the emails note that some email providers automatically expunge emails deleted with delete_messages(instead of waiting for an expunge command from the imap client disconnecting from the imap server when your program has finished retrieving or deleting emailssimply call the imapclient... |
2,915 | log in to an smtp server by calling smtplib smtp()ehlo()starttls()and login(for all members behind on their duessend personalized reminder email by calling the sendmail(method open new file editor tab and save it as sendduesreminders py step open the excel file let' say the excel spreadsheet you use to track membership... |
2,916 | latestmonth sheet cell(row= column=lastcolvalue todocheck each member' payment status todolog in to email account todosend out reminder emails after importing the openpyxlsmtpliband sys moduleswe open our duesrecords xlsx file and store the resulting workbook object in wb then we get sheet and store the resulting works... |
2,917 | once you have list of all unpaid membersit' time to send them email reminders add the following code to your programexcept with your real email address and provider information#python sendduesreminders py sends emails based on payment status in spreadsheet --snip-log in to email account smtpobj smtplib smtp('smtp examp... |
2,918 | value if the smtp server reported an error sending that particular email the last part of the for loop at checks if the returned dictionary is nonempty andif it isprints the recipient' email address and the returned dictionary after the program is done sending all the emailsthe quit(method is called to disconnect from ... |
2,919 | cell phone provider sms gateway mms gateway at& number@txt att net number@mms att net boost mobile number@sms myboostmobile com same as sms cricket number@sms cricketwireless net number@mms cricketwireless net google fi number@msg fi google com same as sms metro pcs number@mymetropcs com same as sms republic wireless n... |
2,920 | pip install --user --upgrade twilio on windows (or use pip on macos and linuxappendix has more details about installing third-party modules note this section is specific to the united states twilio does offer sms texting services for countries other than the united statessee the twilio module and its functions will wor... |
2,921 | using from twilio rest import clientnot just import twilio store your account sid in accountsid and your auth token in authtoken and then call client(and pass it accountsid and authtoken the call to client(returns client object this object has messages attributewhich in turn has create(method you can use to send text m... |
2,922 | updatedmessage status 'deliveredupdatedmessage date_sent datetime datetime( entering message sid shows you this message' long sid by passing this sid to the twilio client' get(method uyou can retrieve new message object with the most up-to-date information in this new message objectthe status and date_sent attributes a... |
2,923 | def textmyself(message) twiliocli client(accountsidauthtokenw twiliocli messages create(body=messagefrom_=twilionumberto=mynumberthis program stores an account sidauth tokensending numberand receiving number it then defined textmyself(to take on argument umake client object vand call create(with the message you passed ... |
2,924 | they're running onpractice questions what is the protocol for sending emailfor checking and receiving emailwhat four smtplib functions/methods must you call to log in to an smtp server what two imapclient functions/methods must you call to log in to an imap server what kind of argument do you pass to imapobj search() w... |
2,925 | showed you how to use the requests module to scrape data from the morning and checks whether it' raining that day if sohave the program text you reminder to pack an umbrella before leaving the house auto unsubscriber write program that scans through your email accountfinds all the unsubscribe links in all your emailsan... |
2,926 | command since you won' be sitting in front of the computer that is running the programit' good idea to use the logging functions (see to write text file log that you can check if errors come up qbittorrent (as well as other bittorrent applicationshas feature where it can quit automatically after the download completes ... |
2,927 | nipul at ing im age if you have digital camera or even if you just upload photos from your phone to facebookyou probably cross paths with digital image files all the time you may know how to use basic graphics softwaresuch as microsoft paint or paintbrushor even more advanced applications such as adobe photoshop but if... |
2,928 | in order to manipulate an imageyou need to understand the basics of how computers deal with colors and coordinates in images and how you can work with colors and coordinates in pillow but before you continueinstall the pillow module see appendix for help installing third-party modules colors and rgba values computer pr... |
2,929 | interactive shellu from pil import imagecolor imagecolor getcolor('red''rgba'( imagecolor getcolor('red''rgba'( imagecolor getcolor('black''rgba'( imagecolor getcolor('chocolate''rgba'( imagecolor getcolor('cornflowerblue''rgba'( firstyou need to import the imagecolor module from pil (not from pillowyou'll see why in m... |
2,930 | means pillow is expecting tuple of four integer coordinates that represent rectangular region in an image the four integers arein orderas followsleft the -coordinate of the leftmost edge of the box top the -coordinate of the top edge of the box right the -coordinate of one pixel to the right of the rightmost edge of th... |
2,931 | adds pounds (which is lot for catif the image file isn' in the current working directorychange the working directory to the folder that contains the image file by calling the os chdir(function import os os chdir(' :\\folder_with_image_file'the image open(function returns value of the image object data typewhich is how ... |
2,932 | ( widthheight catim size width height catim filename 'zophie pngcatim format 'pngcatim format_description 'portable network graphicsy catim save('zophie jpg'after making an image object from zophie png and storing the image object in catimwe can see that the object' size attribute contains tuple of the image' width and... |
2,933 | pixels tallwith purple background this image is then saved to the file purpleimage png we call image new(again to create another image objectthis time passing ( for the dimensions and nothing for the background color invisible black( )is the default color used if no color argument is specifiedso the second image has tr... |
2,934 | the copy(method will return new image object with the same image as the image object it was called on this is useful if you need to make changes to an image but also want to keep an untouched version of the original for exampleenter the following into the interactive shellfrom pil import image catim image open('zophie ... |
2,935 | face pasted twice say you want to tile zophie' head across the entire imageas in figure - you can achieve this effect with just couple for loops continue the interactive shell example by entering the followingcatimwidthcatimheight catim size faceimwidthfaceimheight faceim size catcopytwo catim copy( for left in range( ... |
2,936 | with paste(to duplicate the cat' face ( dupli-catif you willhere we store the width of height of catim in catimwidth and catimheight at we make copy of catim and store it in catcopytwo now that we have copy that we can paste ontowe start looping to paste faceim onto catcopytwo the outer for loop' left variable starts a... |
2,937 | int(height for the new height vso the image object returned from resize(will be half the length and width of the original imageor onequarter of the original image size overall the resize(method accepts only integers in its tuple argumentwhich is why you needed to wrap both divisions by in an int(call this resizing keep... |
2,938 | figure - on macostransparent pixels are used for the gaps instead the rotate(method has an optional expand keyword argument that can be set to true to enlarge the dimensions of the image to fit the entire rotated new image for exampleenter the following into the interactive shellcatim rotate( save('rotated png'catim ro... |
2,939 | changing individual pixels the color of an individual pixel can be retrieved or set with the getpixel(and putpixel(methods these methods both take tuple representing the xand -coordinates of the pixel the putpixel(method also takes an additional tuple argument for the color of the pixel this color argument is four-inte... |
2,940 | but don' know the rgb tuple for dark gray the putpixel(method doesn' accept standard color name like 'darkgray'so you have to use imagecolor getcolor(to get color tuple from 'darkgrayloop through the pixels in the bottom half of the image and pass putpixel(the return value of imagecolor getcolor(zand you should now hav... |
2,941 | load the logo image loop over all png and jpg files in the working directory check whether the image is wider or taller than pixels if soreduce the width or height (whichever is largerto pixels and scale down the other dimension proportionally paste the logo image into the corner save the altered images to another fold... |
2,942 | start of the programwe've made it easy to change the program later say the logo that you're adding isn' the cat iconor say you're reducing the output imageslargest dimension to something other than pixels with these constants at the start of the programyou can just open the codechange those values onceand you're done (... |
2,943 | the program should resize the image only if the width or height is larger than square_fit_size ( pixelsin this case)so put all of the resizing code inside an if statement that checks the width and height variables add the following code to your program#python resizeandaddlogo py resizes all images in current working di... |
2,944 | logo will be the image width minus the logo widththe top coordinate for where to paste the logo will be the image height minus the logo height image width logo width logo height image height image logo figure - the left and top coordinates for placing the logo in the bottom-right corner should be the image width/height... |
2,945 | looks like figure - remember that the paste(method will not paste the transparency pixels if you do not pass the logoim for the third argument as well this program can automatically resize and "logo-ifyhundreds of images in just couple minutes figure - the image zophie png resized and the logo added (leftif you forget ... |
2,946 | casea white imageand store the image object in im we pass the image object to the imagedraw draw(function to receive an imagedraw object this object has several methods for drawing shapes and text onto an image object store the imagedraw object in variable like draw so you can use it easily in the following example dra... |
2,947 | the polygon(xyfilloutlinemethod draws an arbitrary polygon the xy argument is list of tuplessuch as [(xy)(xy)]or integerssuch as [ ]representing the connecting points of the polygon' sides the last pair of coordinates will be automatically connected to the first pair the optional fill argument is the color of the insid... |
2,948 | the full documentation is available at /reference/imagedraw html drawing text the imagedraw object also has text(method for drawing text onto an image the text(method takes four argumentsxytextfilland font the xy argument is two-integer tuple specifying the upper-left corner of the text box the text argument is the str... |
2,949 | the actual folder name your operating system usesfrom pil import imageimagedrawimagefont import os im image new('rgba'( )'white' draw imagedraw draw(imw draw text(( )'hello'fill='purple'fontsfolder 'font_foldere '/library/fontsx arialfont imagefont truetype(os path join(fontsfolder'arial ttf') draw text(( )'howdy'fill=... |
2,950 | dimensions are stored as two-integer tuple in the size attribute objects of the image data type also have methods for common image manipulationscrop()copy()paste()resize()rotate()and transpose(to save the image object to an image filecall the save(method if you want your program to draw shapes onto an imageuse imagedra... |
2,951 | check is case insensitive finallythe logo added to the bottom-right corner is meant to be just small markbut if the image is about the same size as the logo itselfthe result will look like figure - modify resizeandaddlogo py so that the image must be at least twice the width and height of the logo image before the logo... |
2,952 | numnonphotofiles + continue skip to next filename open image file using pillow check if width height are larger than if todoimage is large enough to be considered photo numphotofiles + elseimage is too small to be photo numnonphotofiles + if more than half of files were photosprint the absolute path of the folder if to... |
2,953 | controlling the ke yboard and mouse with gui au tom at ion knowing various python modules for editing spreadsheetsdownloading filesand launching programs is usefulbut sometimes there just aren' any modules for the applications you need to work with the ultimate tools for automating tasks on your computer are programs y... |
2,954 | usually marketed as robotic process automation (rpathese products are effectively no different than the python scripts you can make yourself with the pyautogui modulewhich has functions for simulating mouse movementsbutton clicksand mouse wheel scrolls this covers only subset of pyautogui' featuresyou can find the full... |
2,955 | you'll be prompted to enter your password to confirm these changes staying on track before you jump into gui automationyou should know how to escape problems that may arise python can move your mouse and type keystrokes at an incredible speed in factit might be too fast for other programs to keep up with alsoif somethi... |
2,956 | all coordinates are positive integersthere are no negative coordinates increases ( , increases ( , ( , ( , figure - the coordinates of computer screen with resolution your resolution is how many pixels wide and tall your screen is if your screen' resolution is set to then the coordinate for the upperleft corner will be... |
2,957 | now that you understand screen coordinateslet' move the mouse the pyautogui moveto(function will instantly move the mouse cursor to specified position on the screen integer values for the xand -coordinates make up the function' first and second argumentsrespectively an optional duration integer or float keyword argumen... |
2,958 | point( = = pyautogui position(and again point( = = [ the -coordinate is at index the -coordinate is also in the attribute of courseyour return values will vary depending on where your mouse cursor is controlling mouse interaction now that you know how to move the mouse and figure out where it is on the screenyou're rea... |
2,959 | dragging means moving the mouse while holding down one of the mouse buttons for exampleyou can move files between folders by dragging the folder iconsor you can move appointments around in calendar app pyautogui provides the pyautogui dragto(and pyautogui drag(functions to drag the mouse cursor to new location or locat... |
2,960 | drawn with ms paint' different brushes the distance variable starts at so on the first iteration of the while loopthe first drag(call drags the cursor pixels to the righttaking seconds distance is then decreased to xand the second drag(call drags the cursor pixels down the third drag(call drags the cursor - horizontall... |
2,961 | positive integer scrolls upand passing negative integer scrolls down run the following in mu editor' interactive shell while the mouse cursor is over the mu editor windowpyautogui scroll( you'll see mu scroll upward if the mouse cursor is over text field that can be scrolled up planning your mouse movements one of the ... |
2,962 | one of the eight copy or log buttons the copy allcopy xycopy rgband copy rgb hex buttons will copy their respective information to the clipboard the log alllog xylog rgband log rgb hex buttons will write their respective information to the large text field in the window you can save the text in this log text field by c... |
2,963 | say that one of the steps in your gui automation program is to click gray button before calling the click(methodyou could take screenshot and look at the pixel where the script is about to click if it' not the same gray as the gray buttonthen your program knows something is wrong maybe the window moved unexpectedlyor m... |
2,964 | but what if you do not know beforehand where pyautogui should clickyou can use image recognition instead give pyautogui an image of what you want to clickand let it figure out the coordinates for exampleif you have previously taken screenshot to capture the image of submit button in submit pngthe locateonscreen(functio... |
2,965 | will be one four-integer tuple for each location where the image is found on the screen continue the interactive shell example by entering the following (and replacing 'submit pngwith your own image filename)list(pyautogui locateallonscreen('submit png')[( )( )each of the four-integer tuples represents an area on the s... |
2,966 | the active window on your screen is the window currently in the foreground and accepting keyboard input if you're currently writing code in the mu editorthe mu editor' window is the active window of all the windows on your screenonly one will be active at time in the interactive shellcall the pyautogui getactivewindow(... |
2,967 | pyautogui click(fw left fw top you can now use these attributes to calculate precise coordinates within window if you know that button you want to click is always pixels to the right of and pixels down from the window' top-left cornerand the window' top-left corner is at screen coordinates ( )then calling pyautogui cli... |
2,968 | about the window' size and position after calling these functions in mu editorthe window should move and become narrower was in figure - figure - the mu editor window before (topand after (bottomusing the window object attributes to move and resize it you can also find out and change the window' minimizedmaximizedand a... |
2,969 | fw isactive returns true if window is the active window true fw maximize(maximizes the window fw ismaximized true fw restore(undoes minimize/maximize action fw minimize(minimizes the window import time wait seconds while you activate different windowtime sleep( )fw activate(fw close(this will close the window you're ty... |
2,970 | write(callswhich would mess up the example python will first send virtual mouse click to the coordinates ( )which should click the file editor window and put it in focus the write(call will send the text helloworldto the windowmaking it look like figure - you now have code that can type for youfigure - using pyautoggui... |
2,971 | output xyab table - lists the pyautogui keyboard key strings that you can pass to write(to simulate pressing any combination of keys you can also examine the pyautogui keyboard_keys list to see all possible keyboard key strings that pyautogui will accept the 'shiftstring refers to the left shift key and is equivalent t... |
2,972 | (obtained by holding the shift key and pressing )pyautogui keydown('shift')pyautogui press(' ')pyautogui keyup('shift'this line presses down shiftpresses (and releases and then releases shift if you need to type string into text fieldthe write(function is more suitable but for applications that take single-key commands... |
2,973 | add generous pauses while waiting for content to loadyou don' want your script to begin clicking before the application is ready use locateonscreen(to find buttons and menus to clickrather than relying on xy coordinates if your script can' find the thing it needs to clickstop the program rather than let it continue bli... |
2,974 | middleclick(simulates middle-button click doubleclick(simulates double left-button click mousedown(xybuttonsimulates pressing down the given button at the position xy mouseup(xybuttonsimulates releasing the given button at the position xy scroll(unitssimulates the scroll wheel positive argument scrolls upa negative arg... |
2,975 | of all the boring tasksfilling out forms is the most dreaded of chores it' only fitting that nowin the final projectyou will slay it say you have huge amount of data in spreadsheetand you have to tediously retype it into some other application' form interface--with no intern to do it for you although some applications ... |
2,976 | call pyautogui click(to click the form and submit button call pyautogui write(to enter text into the fields handle the keyboardinterrupt exception so the user can press ctrl- to quit open new file editor window and save it as formfiller py step figure out the steps before writing codeyou need to figure out the exact ke... |
2,977 | #python formfiller py automatically fills in the form import pyautoguitime todogive the user chance to kill the script todowait until the form page has loaded todofill out the name field todofill out the greatest fear(sfield todofill out the source of wizard powers field todofill out the robocop field todofill out the ... |
2,978 | each dictionary has names of text fields as keys and responses as values the last bit of setup is to set pyautogui' pause variable to wait half second after each function call alsoremind the user to click on the browser to make it the active window add the following to your program after the formdata assignment stateme... |
2,979 | terminal window to let the user know what' going on since the form has had time to loadcall pyautogui write(['\ ''\ ']to press tab twice and put the name field into focus then call write(again to enter the string in person['name' the '\tcharacter is added to the end of the string passed to write(to simulate pressing ta... |
2,980 | value at the 'sourcekey in this user' dictionary is 'wanduwe simulate pressing the down arrow key once (to select wandand pressing tab if the value at the 'sourcekey is 'amulet'we simulate pressing the down arrow key twice and pressing taband so on for the other possible answers the argument in these write(calls add ha... |
2,981 | in the information for each person in this examplethere are only four people to enter but if you had , peoplethen writing program to do this would save you lot of time and typingdisplaying message boxes the programs you've been writing so far all tend to use plaintext output (with the print(functionand input (with the ... |
2,982 | prompt()and password(these functions can be used to provide notifications or ask the user questions while the rest of the program interacts with the computer through the mouse and keyboard the full online documentation can be found at summary gui automation with the pyautogui module allows you to interact with applicat... |
2,983 | how can you trigger pyautogui' fail-safe to stop programwhat function returns the current resolution()what function returns the coordinates for the mouse cursor' current position what is the difference between pyautogui moveto(and pyautogui move() what functions can be used to drag the mouse what function call will typ... |
2,984 | and then send the ctrl- or - hotkey to "select alland ctrl- or - hotkey to "copy to clipboard your python script can then read the clipboard text by running import pyperclip and pyperclip paste(write program that follows this procedure for copying the text from window' text fields use pyautogui getwindowswithtitle('not... |
2,985 | there is great tutorial titled "how to build python bot that can play web gamesthat you can find link to at tutorial explains how to create gui automation program in python that plays flash game called sushi go round the game involves clicking the correct ingredient buttons to fill customerssushi orders the faster you ... |
2,986 | ins ta lling third-pa module many developers have written their own modulesextending python' capabilities beyond what is provided by the standard library of modules packaged with python the primary way to install third-party modules is to use python' pip tool this tool securely downloads and installs python modules ont... |
2,987 | to install pip on fedora linuxenter sudo yum install python -pip into terminal window you'll need to enter the administrator password for your computer the pip tool is run from terminal (also called command linewindownot from python' interactive shell on windowsrun the "command promptprogram from the start menu on maco... |
2,988 | along with their versions you can enter these commands separately if you only want to install few of these modules on your computer note pip install --user send trash=pip install --user openpyxl=pip install --user requests=pip install --user beautifulsoup =pip install --user selenium=pip install --user pypdf =pip insta... |
2,989 | the first edition of this book suggested using the sudo command if you encountered permission errors while running pipsudo pip install module this is bad practiceas it installs modules to the python installation used by your operating system your operating system may run python scripts to carry out system-related tasks... |
2,990 | running progr ams if you have program open in murunning it is simple matter of pressing or clicking the run button at the top of the window this is an easy way to run programs while writing thembut opening mu to run your finished programs can be burden there are more convenient ways to execute python scriptsdepending o... |
2,991 | command promptand press enter on macosclick on the spotlight icon in the upper righttype terminaland press enter on ubuntu linuxyou can press the win key to bring up dashtype terminaland press enter the keyboard shortcut ctrl-alt- will also open terminal window on ubuntu just as the interactive shell has promptthe term... |
2,992 | "helloworld!program would look like thismicrosoft windows [version ( microsoft corporation all rights reserved :\users\al>python hello py helloworldc:\users\alrunning python (or python without any filename will cause python to launch the interactive shell running python programs on windows there are few other ways you ... |
2,993 | this file with bat file extension (for examplepythonscript batthe sign at the start of each command prevents it from being displayed in the terminal windowand the %forwards any command line arguments entered after the batch filename to the python script the python scriptin turnreads the command line arguments in the sy... |
2,994 | and open terminal window to move the file with the mv /home/al/example desktop /home/allocal/share/applications command when the example desktop file is in the /home/allocal/share/applications folderyou'll be able to press the windows key on your keyboard to bring up dash and type example py (or whatever you put for th... |
2,995 | answers to the pr actice questions this appendix contains the answers to the practice problems at the end of each highly recommend that you take the time to work through these problems programming is more than memorizing syntax and list of function names as when learning foreign languagethe more practice you put into i... |
2,996 | the operators are +-*and the values are 'hello'- and the variable is spamthe string is 'spamstrings always start and end with quotes the three data types introduced in this are integersfloatingpoint numbersand strings an expression is combination of values and operators all expressions evaluate (that isreduceto single ... |
2,997 | ==!= condition is an expression used in flow control statement that evaluates to boolean value the three blocks are everything inside the if statement and the lines print('bacon'and print('ham' =is the equal to operator that compares two values and evaluates to booleanwhile is the assignment operator that stores value ... |
2,998 | functions reduce the need for duplicate code this makes programs shortereasier to readand easier to update the code in function executes when the function is callednot when the function is defined the def statement defines (that iscreatesa function function consists of the def statement and the code in its def clause f... |
2,999 | the operator for list concatenation is +while the operator for replication is (this is the same as for strings while append(will add values only to the end of listinsert(can add them anywhere in the list the del statement and the remove(list method are two ways to remove values from list both lists and strings can be p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.