id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
7,000 | simple substitution cipher the simple substitution cipher substitutes one letter for another since there are possible substitutions for the letter possible substitutions for for cand so onthe total number of possible keys is or , , , , , , , , keysthat' far too many keys for even supercomputer to brute forceso the code... |
7,001 | when you run simplesubcipher pythe output will look like thissimple substitution cipherby al sweigart simple substitution cipher has one-to-one translation for each symbol in the plaintext and each symbol in the ciphertext do you want to ( )ncrypt or ( )ecrypte please specify the key to use or enter random to have one ... |
7,002 | view this code at tagsshortcryptographymath"" import random try import pyperclip pyperclip copies text to the clipboard except importerror pass if pyperclip is not installeddo nothing it' no big deal every possible symbol that can be encrypted/decrypted letters 'abcdefghijklmnopqrstuvwxyz def main() print('''simple sub... |
7,003 | display the results print('the %sed message is:(mymode) print(translated try pyperclip copy(translated print('full %sed text copied to clipboard (mymode) except pass do nothing if pyperclip wasn' installed def checkkey(key) """return true if key is valid otherwise return false "" keylist list(key letterslist list(lette... |
7,004 | translated +symbol return translated def generaterandomkey() """generate and return random encryption key "" key list(lettersget list from the letters string random shuffle(keyrandomly shuffle the list return 'join(keyget string from the list if this program was run (instead of imported)run the program if __name__ ='__... |
7,005 | sine message this program displays message of the user' choice in wavy pattern as the text scrolls up it accomplishes this effect with math sin()which implements the trigonometric sine wave function but even if you don' understand the maththis program is rather short and easy to copy |
7,006 | when you run sinemessage pythe output will look like thissine messageby al sweigart al@inventwithpython com (press ctrl- to quit what message do you want to display(max chars < programmingi < programmingi < programmingi < programmingi < programmingi < programmingi < programmingi < programmingi < programmingi < programm... |
7,007 | program """sine messageby al sweigart al@inventwithpython com create sine-wavy message view this code at tagstinyartistic"" import mathshutilsystime get the size of the terminal window widthheight shutil get_terminal_size( we can' print to the last column on windows without it adding newline automaticallyso reduce the ... |
7,008 | sliding tile puzzle this classic puzzle relies on board with numbered tiles and one free space the objective is to slide the tiles until the numbers are in the correct ordergoing left to right and top to bottom tiles can only slideyou're not allowed to directly pick them up and rearrange them some versions of this puzz... |
7,009 | when you run slidingtilepuzzle pythe output will look like thissliding tile puzzleby al sweigart al@inventwithpython com use the wasd keys to move the tiles back into their original order press enter to begin ++++ ++++ ++++ ++++ ++++(wenter wasd (or quit)( (dw ++++ ++++ ++++ ++++ ++++ project # |
7,010 | enter wasd (or quit)( ( ( --snip-how it works the data structure that represents the sliding tile game board is list of lists the inner lists each represent one column of the board and contain strings for the numbered tiles (or the blank string to represent the blank spacethe getnewboard(function returns this list of l... |
7,011 | return [[' '' '' '' '][' '' '' '' '] [' '' '' '' '][' '' '' 'blank] def displayboard(board) """display the given board on the screen "" labels [board[ ][ ]board[ ][ ]board[ ][ ]board[ ][ ] board[ ][ ]board[ ][ ]board[ ][ ]board[ ][ ] board[ ][ ]board[ ][ ]board[ ][ ]board[ ][ ] board[ ][ ]board[ ][ ]board[ ][ ]board[ ]... |
7,012 | sys exit( if response in ( dreplace(''') return response def makemove(boardmove) """carry out the given move on the given board "" notethis function assumes that the move is valid bxby findblankspace(board if move =' ' board[bx][by]board[bx][by+ board[bx][by+ ]board[bx][by elif move =' ' board[bx][by]board[bx+ ][byboar... |
7,013 | create "solve automaticallymodewhich saves the current arrangement of the tiles and then attempts up to random moves and stops if they have solved the puzzle otherwisethe puzzle loads the saved state and attempts another random moves exploring the program try to find the answers to the following questions experiment wi... |
7,014 | snail ace you won' be able to handle the fast-paced excitement of these racing snails but what they lack in speed they make up for in ascii-art cuteness each snail (represented by an character for the shell and for the two eyestalksmoves slowly but surely toward the finish line up to eight snailseach with custom nameca... |
7,015 | when you run snailrace pythe output will look like thissnail raceby al sweigart al@inventwithpython com @ <-snail how many snails will racemax enter snail # ' namealice enter snail # ' namebob enter snail # ' namecarol start alice @ bob @ carol @ --snip-finish how it works this program makes use of two data structuress... |
7,016 | while truekeep asking until the player enters number print('how many snails will racemax:'max_num_snails response input('' if response isdecimal() numsnailsracing int(response if numsnailsracing <max_num_snails break print('enter number between and'max_num_snails enter the names of each snail snailnames [list of the st... |
7,017 | display the start and finish linesprint('start((finish_line len('start')'finish')print('|((finish_line '|')display the snails (with name tags)for snailname in snailnamesspaces snailprogress[snailnameprint((spacessnailname[:max_name_length]print((snailprogress[snailname]'@ 'after entering the source code and running it ... |
7,018 | so ro ba pa bac an abacusalso called counting frameis calculating tool used in many cultures long before electronic calculators were invented figure - shows the japanese form of the abacuscalled soroban each wire represents place in positional numeral systemand the beads on the wire represent the digit at that place fo... |
7,019 | each column in the soroban represents different digit the rightmost column is the ones placethe column to its left is the tens placethe column to the left of that is the hundreds placeand so on the qwertyuioand keys along the top of your keyboard can increase the digit at their respective positionswhile the asdfghjklan... |
7,020 | +================================ +== == == == == == == == == == ==+ - (enter number"quit"or stream of up/down letters --snip-how it works the displayabacus(function accepts number argument used to figure out where it should render beads on the abacus the soroban always has exactly possible locations for either 'obeads... |
7,021 | project # while truemain program loop displayabacus(abacusnumberdisplaycontrols(commands input(''if commands ='quit'quit the programbreak elif commands isdecimal()set the abacus numberabacusnumber int(commandselsehandle increment/decrement commandsfor letter in commandsif letter =' 'abacusnumber + elif letter =' 'abacu... |
7,022 | the abacus can' show negative numbers if abacusnumber abacusnumber change any negative numbers to the abacus can' show numbers larger than if abacusnumber abacusnumber def displayabacus(number) numberlist list(str(numberzfill(number_of_digits) hasbead [contains true or false for each bead position top heaven row has be... |
7,023 | chars abacuschar numberlist print("" +================================ {{{{{{{{{{ {{{{{{{{{{ +================================ {{{{{{{{{{ {{{{{{{{{{ {{{{{{{{{{ {{{{{{{{{{ {{{{{{{{{{ {{{{{{{{{{ +=={}=={}=={}=={}=={}=={}=={}=={}=={}=={}==+""format(*chars) def displaycontrols() print(+ ' print(- ;' print('(enter number"qu... |
7,024 | sound mimic similar to the simon electronic toythis memorization game uses the third-party playsound module to play four different soundswhich correspond to the asdand keys on the keyboard as you successfully repeat the pattern the game gives youthe patterns get longer and longer how many sounds can you hold in your sh... |
7,025 | program more information about the playsound module can be found at module from the program in action when you run soundmimic pythe output will look like thissound mimicby al sweigart al@inventwithpython com try to memorize pattern of letters (each with its own soundas it gets longer and longer press enter to begin pat... |
7,026 | download the sound files from these urls (or use your own) try import playsound except importerror print('the playsound module needs to be installed to run this' print('program on windowsopen command prompt and run:' print('pip install playsound' print('on macos and linuxopen terminal and run:' print('pip install plays... |
7,027 | print('you scored'len(pattern 'points 'print('thanks for playing!'break time sleep( exploring the program try to find the answers to the following questions experiment with some modifications to the code and rerun the program to see what effect the changes have what happens if you delete or comment out print('\ on line... |
7,028 | spongecase you've probably seen the "mocking spongebobmemea picture of spongebob squarepantswith caption whose text alternates between upperand lowercase letters to indicate sarcasmlike thisusing spongebob memes does not make you witty for some randomnessthe text sometimes doesn' alternate capitalization this short pro... |
7,029 | when you run spongecase pythe output will look like thisspongecaseby al sweigart al@inventwithpython com enter your messageusing spongebob memes does not make you witty using spongebob memes does not make you witty (copied spongetext to clipboard how it works the code in this program uses for loop on line to iterate ov... |
7,030 | useupper false for character in message if not character isalpha() spongetext +character continue if useupper spongetext +character upper( else spongetext +character lower( flip the case of the time if random randint( < useupper not useupper flip the case return spongetext if this program was run (instead of imported)r... |
7,031 | sudoku puz zle sudoku is popular puzzle game in newspapers and mobile apps the sudoku board is grid in which the player must place the digits to onceand only oncein each rowcolumnand subgrid the game begins with few spaces already filled in with digitscalled givens well-formed sudoku puzzle will have only one possible ... |
7,032 | when you run sudoku pythe output will look like thissudoku puzzleby al sweigart al@inventwithpython com --snip- ++ ++ enter moveor resetnewundooriginalor quit(for examplea move looks like " --snip-how it works objects of the sudokugrid class are the data structures that represent the sudoku grid you can call their meth... |
7,033 | empty_space grid_length box_length full_grid_size grid_length grid_length class sudokugrid def __init__(selforiginalsetup) originalsetup is string of characters for the puzzle setupwith numbers and periods (for the blank spaces see self originalsetup originalsetup the state of the sudoku grid is represented by dictiona... |
7,034 | self moves list ""if self moves =[]return no states in self movesso do nothing self moves pop(remove the current state if self moves =[]self resetgrid(elseset the grid to the last move self grid copy copy(self moves[- ]def display(self)"""display the current state of the grid on the screen ""print( 'display column labe... |
7,035 | check each box for boxx in ( ) for boxy in ( ) boxnumbers [ for in range(box_length) for in range(box_length) number self grid[(boxx xboxy ) boxnumbers append(number if not self _iscompletesetofnumbers(boxnumbers) return false return true print('''sudoku puzzleby al sweigart al@inventwithpython com sudoku is number pla... |
7,036 | get the player' actionwhile truekeep asking until the player enters valid action print(print newline print('enter moveor resetnewundooriginalor quit:'print('(for examplea move looks like " )'action input(''upper(strip(if len(action and action[ in (' '' '' '' '' ')player entered valid action break if len(action split()=... |
7,037 | quit the game print('thanks for playing!'sys exit(handle the move the player selected if grid makemove(columnrownumber=falseprint('you cannot overwrite the original grid\' numbers 'print('enter original to view the original grid 'input('press enter to continue 'exploring the program try to find the answers to the follo... |
7,038 | - this program demonstrates the use of the pyttsx third-party module any message you enter will be spoken out loud by your operating system' text-to-speech capabilities although computer-generated speech is an incredibly complex branch of computer sciencethe pyttsx module provides an easy interface for itmaking this sm... |
7,039 | when you run texttospeechtalker pythe output will look like thistext to speech talkerby al sweigart al@inventwithpython com text-to-speech using the pyttsx modulewhich in turn uses the nsspeechsynthesizer (on macos)sapi (on windows)or espeak (on linuxspeech engines enter the text to speakor quit to quit hello my name i... |
7,040 | if text upper(='quit'print('thanks for playing!'sys exit(tts say(textadd some text for the tts engine to say tts runandwait(make the tts engine say it exploring the program this is base programso there aren' many options to customize it insteadconsider what other programs of yours would benefit from text-to-speech text... |
7,041 | three-card monte three-card monte is common scam played on gullible tourists and other easy marks three playing cardsone of which is the "red ladyqueen of heartsare put facedown on cardboard box the dealer quickly rearranges the cards and then asks the mark to pick the queen of hearts but the dealer can use all sorts o... |
7,042 | experienceyou can enable the cheat featurewhich causes the player to always loseeven if they select the correct card the program in action when you run threecardmonte pythe output will look like thisthree-card monteby al sweigart al@inventwithpython com find the red lady (the queen of hearts)keep an eye on how the card... |
7,043 | find the queen of hearts after cards have been swapped around (in the real-life versionthe scammer palms the queen of hearts so you always lose more info at view this code at tagslargecard gamegame"" import randomtime set up the constants num_swaps (!try changing this to or delay (!try changing this or the card suit ch... |
7,044 | print('three-card monteby al sweigart al@inventwithpython com' print( print('find the red lady (the queen of hearts)keep an eye on how' print('the cards move ' print( show the original arrangement cards [(' 'hearts)getrandomcard()getrandomcard() random shuffle(cardsput the queen of hearts in random place print('here ar... |
7,045 | guessindex break (!uncomment this code to make the player always lose #if cards[guessindex=(' 'hearts) player has wonso let' move the queen possiblenewindexes [ possiblenewindexes remove(guessindexremove the queen' index newind random choice(possiblenewindexeschoose new index place the queen at the new index cards[gues... |
7,046 | - - tic-tac-toe is classic pencil-and-paper game played on grid players take turns placing their or markstrying to get three in row most games of tic-tac-toe end in tiebut it is possible to outsmart your opponent if they're not careful |
7,047 | when you run tictactoe pythe output will look like thiswelcome to tic-tac-toe -+-+ -+-+ what is ' move( - -+-+ -+-+ what is ' move( - --snip- | | -+-+ | | -+-+ | | the game is tiethanks for playinghow it works to represent tic-tac-toe boards in this programwe use dictionary with keys ' through ' for the spaces on the b... |
7,048 | keep asking the player until they enter number - move none while not isvalidspace(gameboardmove) print('what is {}\' move( - )format(currentplayer) move input('' updateboard(gameboardmovecurrentplayermake the move check if the game is over if iswinner(gameboardcurrentplayer)check for winner print(getboardstr(gameboard)... |
7,049 | shorter variable names used here for readability bp boardplayer check for marks across rows columnsand diagonals return (( [' '= [' '= [' '=por across top ( [' '= [' '= [' '=por across middle ( [' '= [' '= [' '=por across bottom ( [' '= [' '= [' '=por down left ( [' '= [' '= [' '=por down middle ( [' '= [' '= [' '=por ... |
7,050 | tower of hanoi the tower of hanoi is stack-moving puzzle game that features three poles on which you can stack various-sized disks the object of the game is to move one tower of disks to another pole howeveronly one disk can be moved at timeand larger disks cannot be placed on top of smaller ones figuring out certain p... |
7,051 | when you run towerofhanoi pythe output will look like thisthe tower of hanoiby al sweigart al@inventwithpython com move the tower of disksone disk at timeto another tower larger disks cannot rest on top of smaller disk more info at |@ @@ @@@@ @@@@@@ @@@@@@@@ @@@@ |||||| |||||| enter the letters of "fromand "totowersor ... |
7,052 | values in listrespectively this is useful for finding the disk currently at the top of the tower """the tower of hanoiby al sweigart al@inventwithpython com stack-moving puzzle game view this code at tagsshortgamepuzzle"" import copy import sys total_disks more disks means more difficult puzzle start with all disks on ... |
7,053 | print('( ab to moves disk from tower to tower )' response input(''upper(strip( if response ='quit' print('thanks for playing!' sys exit( make sure the user entered valid tower letters if response not in ('ab''ac''ba''bc''ca''cb') print('enter one of abacbabccaor cb ' continue ask player again for their move syntactic s... |
7,054 | display the disk disk '@width numlabel str(widthrjust( ' ' print(emptyspace disk numlabel disk emptyspaceend='' if the program is run (instead of imported)run the game if __name__ ='__main__' main(exploring the program try to find the answers to the following questions experiment with some modifications to the code and... |
7,055 | trick questions what does yellow stone thrown into blue pond becomedo they have th of july in englandhow can doctor go days without sleepwhatever you think the answers to these trick questions areyou're probably wrong the questions in this program have been specifically crafted so that their answers are simpleobviousan... |
7,056 | when you run trickquestions pythe output will look like thistrick questionsby al sweigart al@inventwithpython com can you figure out the answers to these trick questions(enter quit to quit at any time press enter to begin --snip-question score questiona year old person was born on the nd of february what year is their ... |
7,057 | {'question'"how many times can you take apples from pile of apples?"'answer'"once then you have pile of apples "'accept'['once''one'' ']}{'question''what begins with "eand ends with "ebut only has one letter in it?''answer'"an envelope "'accept'['envelope']}{'question'"is it possible to draw square with three sides?"'a... |
7,058 | 'answer'"eight they also have two thumbs "'accept'['eight'' ']}{'question'"the th of july is holiday in america do they have th of july in england?"'answer'"yes all countries have th of july on their calendar "'accept'['yes']}{'question'"which letter of the alphabet makes honey?"'answer'"none bee is an insectnot letter... |
7,059 | 'accept'['bottom']}{'question'" person puts two walnuts in their pocket but only has one thing in their pocket five minutes later what is it?"'answer'" hole "'accept'['hole']}{'question'"what did the sculptor make that no one could see?"'answer'"noise "'accept'['noise']}{'question'"if you drop raw egg on concrete floor... |
7,060 | 'accept'['orange']}{'question'"who is the president if the vice president dies?"'answer'"the current president "'accept'['president''current''already']}{'question'" doctor gives you three pills with instructions to take one every half-hour how long will the pills last?"'answer'"one hour "'accept'[' ''one']}{'question'"... |
7,061 | else text random choice(incorrect_text print(text'the answer is:'qa['answer'] response input('press enter for the next question 'lower( if response ='quit' print('thanks for playing!' sys exit( print("that' all the questions thanks for playing!"after entering the source code and running it few timestry making experimen... |
7,062 | ye gabriele cirullia web developerinvented the game in one weekend it was inspired by veewo studios gamewhich in turn was inspired by threes! game by the development team sirvo in you must merge numbers on board to clear them from the screen two merge into two merge into an and so on the game adds new to the board on e... |
7,063 | when you run twentyfortyeight pythe output will look like thistwenty forty-eightby al sweigart al@inventwithpython com --snip-++++ ++++ ++++ ++++ ++++score enter move(wasd or to quit--snip-how it works this program implements its sliding behavior using "columndata structuresrepresented by lists of four stringsblank ( s... |
7,064 | figure - columns (highlightedwhen game board is sliding to the right """twenty forty-eightby al sweigart al@inventwithpython com sliding tile game to combine exponentially-increasing numbers inspired by gabriele cirulli' which is clone of veewo studios which in turn is clone of the threesgame more info at view this cod... |
7,065 | if isfull(gameboard) drawboard(gameboard print('game over thanks for playing!' sys exit( def getnewboard() """returns new data structure that represents board it' dictionary with keys of (xytuples and values of the tile at that space the tile is either power-of-two integer or blank the coordinates are laid out as +-+-+... |
7,066 | print("" ++++ |{}|{}|{}|{} ++++ |{}|{}|{}|{} ++++ |{}|{}|{}|{} ++++ |{}|{}|{}|{} ++++ ""format(*labels) def getscore(board) """returns the sum of all the tiles on the board data structure "" score loop over every space and add the tile to the score for in range( ) for in range( ) only add non-blank tiles to the score i... |
7,067 | combinedtiles[aboveindexcombinedtiles[aboveindex combinedtiles[ blank topmost space is always blank return combinedtiles def makemove(boardmove) """carries out the move on the board the move argument is either ' '' '' 'or 'dand the function returns the resulting board data structure "" the board is split up into four c... |
7,068 | boardaftermove[secondtilespacecombinedtilescolumn[ boardaftermove[thirdtilespacecombinedtilescolumn[ boardaftermove[fourthtilespacecombinedtilescolumn[ return boardaftermove def askforplayermove() """asks the player for the direction of their next move (or quit ensures they enter valid moveeither ' '' ''sor ' "" print(... |
7,069 | try to find the answers to the following questions experiment with some modifications to the code and rerun the program to see what effect the changes have what happens if you change return score on line to return what happens if you change board[randomspace on line to board[randomspace project # |
7,070 | vigenere cipher the vigenere ciphermisattributed to thcentury cryptographer blaise de vigenere (others had independently invented it earlier)was impossible to crack for hundreds of years it is essentially the caesar cipherexcept it makes use of multipart key the so-called vigenere key is wordor even random series of le... |
7,071 | analysis weakness that can crack the simple substitution cipher for centuriesthe vigenere cipher represented the state of the art in cryptography you'll notice many similarities between the code for the vigenere and caesar cipher programs more info about the vigenere cipher can be found at more about ciphers and code b... |
7,072 | pass if pyperclip is not installeddo nothing it' no big deal every possible symbol that can be encrypted/decrypted letters 'abcdefghijklmnopqrstuvwxyz def main() print('''vigenere cipherby al sweigart al@inventwithpython com the vigenere cipher is polyalphabetic substitution cipher that was powerful enough to remain un... |
7,073 | """encrypt the message using the key "" return translatemessage(messagekey'encrypt' def decryptmessage(messagekey) """decrypt the message using the key "" return translatemessage(messagekey'decrypt' def translatemessage(messagekeymode) """encrypt or decrypt the message using the key "" translated [stores the encrypted/... |
7,074 | try to find the answers to the following questions experiment with some modifications to the code and rerun the program to see what effect the changes have what happens when you encrypt with the key ' ' what error do you cause when you delete or comment out mykey response on line vigenere cipher |
7,075 | wat in this solitaire puzzle gameyou must use three buckets (three-literfive-literand eight-liter bucketsto collect exactly four liters of water in one of the buckets buckets can only be emptiedcompletely filledor poured into another bucket for exampleyou can fill the five-liter bucket and then pour its contents into t... |
7,076 | when you run waterbucket pythe output will look like thiswater bucket puzzleby al sweigart al@inventwithpython com try to get of water into one of these buckets + + + you can( )ill the bucket ( )mpty the bucket ( )our one bucket into another ( )uit select bucket or quit try to get of water into one of these buckets + -... |
7,077 | bucketthe next five strings the five-liter bucketand the final three strings the three-liter bucket """water bucket puzzleby al sweigart al@inventwithpython com water pouring puzzle more info view this code at tagslargegamemathpuzzle"" import sys print('water bucket puzzleby al sweigart al@inventwithpython com' goal th... |
7,078 | |{ } |{ } |{ } |{ } |{ } |{ } |{ } |{ } |{ } |{ } |{ } |{ } |{ } +++ ''format(*waterdisplay) check if any of the buckets has the goal amount of water for wateramount in waterinbucket values() if wateramount =goal print('good jobyou solved it in'steps'steps!' sys exit( let the player select an action to do with bucket p... |
7,079 | elif move =' 'let the player select bucket to pour intowhile truekeep asking until valid bucket entered print('select bucket to pour into or 'dstbucket input(''upper(if dstbucket in (' '' '' ')break player has selected valid bucket figure out the amount to pourdstbucketsize int(dstbucketemptyspaceindstbucket dstbuckets... |
7,080 | tag the projects in this book are marked with set of tags that describe the type of program they are the first tag indicates their sizetiny ( to lines)short ( to lines)large ( to lines)and extra-large ( lines or morethe size tags are as followstiny# bitmap message# caesar hacker# collatz sequence# countdown# deep cave#... |
7,081 | caesar cipher# calendar maker# cho-han# conway' game of life# dice roller# dna visualization# fibonacci# forest fire sim# ninety nniine boottels# periodic table of the elements# pig latin# powerball lottery# rock paper scissors# seven-segment display module# simple substitution cipher# snail race# sound mimic# tic-tac-... |
7,082 | dice math# fast draw# flooder# four in row# guess the number# hacking minigame# hangman and guillotine# hungry robots# 'accuse!# lucky stars# mancala# maze runner # maze runner # monty hall problem# rock paper scissors# rock paper scissors (always-win version)# royal game of ur# sliding tile puzzle# snail race# sound m... |
7,083 | char ac ter map the print(function allows you to easily make any character you can type on the keyboard appear on the screen howeverthere are many other characters you may like to displaythe heartsdiamondsclubsand spades card suitslinesshaded boxesarrowsmusic notesand so on you can obtain string values of these charact... |
7,084 | python' built-in chr(function accepts an integer argument and returns string of the number' character the ord(function does the oppositeit accepts string argument of single character and returns the character' number this number is the code point for the character in the unicode standard for exampleenter the following ... |
7,085 | when calling the chr(functionyou must pass decimal integer as the argumentnot hexadecimal string table of code points the following are all the unicode code points in the set known as windows glyph list which are the characters supported by the windows terminal programcommand prompt both macos and linux can display mor... |
7,086 | > / / / ae ss ae oe oe character map |
7,087 | python is still the dominant language in the world of information securityeven if the conversation about your language of choice sometimes looks more like religious war python-based tools include all manner of fuzzersproxiesand even the occasional exploit exploit frameworks like canvas are written in python as are more... |
7,088 | python hacker those are two words you really could use to describe me at immunityi am lucky enough to work with people who actuallyreallyknow how to code python am not one of those people spend great deal of my time penetration testingand that requires rapid python tool developmentwith focus on execution and delivering... |
7,089 | would like to thank my family -my beautiful wifeclareand my five childrenemilycartercohenbradyand mason -for all of the encouragement and tolerance while spent year and half of my life writing this book my brotherssistermomdadand paulette have also given me lot of motivation to keep pushing through no matter what love ... |
7,090 | environment this is the least fun -but nevertheless critical -part of the bookwhere we walk through setting up an environment in which to write and test python we are going to do crash course in setting up kali linux virtual machine (vmand installing nice ide so that you have everything you need to develop code by the ... |
7,091 | kali is the successor to the backtrack linux distributiondesigned by offensive security from the ground up as penetration testing operating system it comes with number of tools preinstalled and is based on debian linuxso you'll also be able to install wide variety of additional tools and libraries beyond what' on the o... |
7,092 | pip these are much like the apt package manager because they allow you to directly install python librarieswithout having to manually downloadunpackand install them let' install both of these package managers by issuing the following commandsroot@kali:~#apt-get install python-setuptools python-pip when the packages are... |
7,093 | while typically don' advocate commercial software productswingide is the best ide that 've used in the past seven years at immunity wingide provides all the basic ide functionality like autocompletion and explanation of function parametersbut its debugging capabilities are what set it apart from other ides will give yo... |
7,094 | fire up wingide and open newblank python file then follow along as give you quick rundown of some useful features for startersyour screen should look like figure - with your main code editing area in the top left and set of tabs on the bottom |
7,095 | let' write some simple code to illustrate some of the useful functions of wingideincluding the debug probe and stack data tabs punch the following code into the editordef sum(number_one,number_two)number_one_int convert_integer(number_onenumber_two_int convert_integer(number_tworesult number_one_int number_two_int retu... |
7,096 | now set breakpoint on the line of code that saysreturn converted_integer you can do this by clicking in the left margin or by hitting the key you should see little red dot appear in the margin now run the script by pressing and execution should halt at your breakpoint click the stack data tab and you should see screen ... |
7,097 | |
7,098 | we can see that convert_integer was called from the sum function on line of our python script this becomes very useful if you have recursive function calls or function that is called from many potential places using the stack data tab will come in very handy in your python developing careerthe next major feature is the... |
7,099 | after you make some modificationsyou can resume execution of the script by pressing even though this is very simple exampleit demonstrates some of the most useful features of wingide for developing and debugging python scripts [ that' all we need in order to begin developing code for the rest of this book don' forget a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.