Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
155 views
Python Tricks and Tips - 13th Edition 2023
Python tricks and tips
Uploaded by
aputic
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python_Tricks_And_Tips_-_13th_Edition_2023 For Later
Download
Save
Save Python_Tricks_And_Tips_-_13th_Edition_2023 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
155 views
Python Tricks and Tips - 13th Edition 2023
Python tricks and tips
Uploaded by
aputic
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python_Tricks_And_Tips_-_13th_Edition_2023 For Later
Carousel Previous
Carousel Next
Save
Save Python_Tricks_And_Tips_-_13th_Edition_2023 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 82
Search
Fullscreen
@ Advanced guides and tutorials for programming C++ and Python @ Next level fixes and secrets get to the heart of the Python language neces Everything you need to take draught Nelms aMeleeye relia and much more skills to the next levelTech Guides Available on Who” (TRICKS & TIPS Bee BLS ty Has Pollo Pas UY I martphones A ee Parnes Se) GS: (erupt oA Prognminl Sa > For a full list of titles available visit: www.pclpublications.comALES & TIPS Python Coding Python Coding Tricks & Tips is the perfect digital publication for the user that wants to take their skill set to the next level. Do you want to enhance your user experience? Or wish to gain insider knowledge? Do you want to learn directly from experts in their field? Learn the numerous short cuts that the professionals use? Over the pages of this essential advanced user guide you will learn everything you will need to know to. become a more confident, better skilled and experienced owner. Ona Auser that will make the cur ouE the page absolute most of their and we hi Continues, coding and ultimately ona a be with you Python coding itself. An info ‘Y Stage to advice achievement you can earn by nlotm and ultimately simply enabling us to ‘spire you to exclusively help and teach you 90 Further, the abilities we have gained over our decades of experience.ec eS GL © 48 Text Adventure Script. ae” Cress coer ears Pec eee eee a ca caetis Cray utc: ae rua(OT EDS [Nag tte * "There's so much you can do with Python and within these pages you'll find everything you need to know to become a Python programmer, ready for the next level of advanced coding.”an) ee > i -use_y = False ai ea st ener ig ata Weelactian at the end -adUsing Modules ature Rete arenes eee Ce cage ee eee Rene eaten eee Deere teens and create even more spectacular Sees INN Mee a ELT your use of these modules to adda eccrine Then read on and learn how they can be used to Fashion fantastic code with Plea eR CLE eke cL eae) Breese ursE) vinsroaes Calendar Module Beyond the Time module, the Calendar module can produce some interesting results when executed within your code. It does far more than simply display the date in the Time module-like format, you can actually call up a wall calendar type display. WORKING WITH DATES. The Calendar module is built into Python 3. However, if For some reason it’s not installed you can add it using pip install ‘calendar as a Windows administrator, or sudo pip install calendar For Linux and macOS. PPTSEDD Lunch python 3 and enter: import calendar to ‘There are numerous functions within the Calendar «allup the module and it inherent Functions. Once ‘module that may be oF interestto you when it’s loaded into memory, start by entering: Forming your own code. For example, you can display the number of leap years between two specific years: Seat, Sept 2. AT) ‘ype Scapyright™, "eredits” or “1icense()” for more information SoS Sart calendar 7. 23 Iteeeahedar apap ston, 208) ‘You can see thatthe days of September 2019 are You could even fashion that particular example into displayed ina wall calendar fashion. Naturally you 2 piece of working, user interactive Python code: can change the 2019, 9 part ofthe second line to any year and ‘month you want, a birthday for example (1973, 6). The first ine configures TextCalendar to star its weeks on a Sunday, you can opt For Monday iF you prefer. Pythons shat -ex 5S rece ryt einerYou can also create a program that will splay all the days, weeks and months within a given year: \We're sure you'lagree thats quite a handy bit of code to have tohand. Siar Interestingly we can also list the number of daysina ‘month by using a simple; or loop:
FETED the ossystem( function's what allows interaction with external programs; you can even call up previous Python programs using this method. You will obviously reed to know the ful path and program file name fort to work successfully. However, you can use the following import os os-system(*start chrome "https://wmw. youtube.com/ feed/maeic’) The ably to marbulte rectors or folders bland you prefer, is one of the OS module's best features. For example, to create anew directory you can use import os (06 mkdir ("NEW") ‘This creates a new directory within the Current Working Directory, named according to the object inthe mkair Function, FETTER For step 5's example we used Windows, to show that the OS module works roughly the same across all platforms. n that case, we opened YouTube's music Feed page, so Itistherefore possible to open specific pages: import os ce eystem(‘chromiun-browser "http:// banpublications.com/*/) Note in the previous step’s example the use of single and double-quotes. The single quotes encase the entire command and launching Chromium, whereas the double {quotes open the spectied page. You can even use variables to call ‘multiple tabs the same browser: import os a=(‘chronium-browser “htty con/**) be (*chromiumbrowser “heey os.system(a + b) +/ Podmpublications. /ome google.co.uk"") You can also rename any directories you've created byentering: import os (os.rename (NEW soup") To delete ther: import os (o6.rndix(*0z0") ‘Another module that goes together with OSis shutil, You can use the Shutil module together with OSand time to create atime-stamped backup directory, and copy files into import os, shutil, time root_sre_dir = r/hone/pi/Documents" root_dst_dir = ‘/home/pi/backup/" + time.asctime() for ere_dix, dirs, files in oa.walk(root_sre dir): dst_dir = sxe_dir.replace(root_src_dir, root_ aet_dir, 0) Af not og.path.exiats (dst_dir): os makedirs (dst_dir) for file_ in files os.path.join(sre dir, file, EE be.path.oniete (ant_f4le) ca, omove (dette) ahucliveopyters tile, dst_aie) print ("sssssssssoBackup completecceececece")[vane Using the Math Module One of the most used modules you will come across is the Math module. As we've Nea se CUA Ne Cel Need rere Le ne TITEL Te) eee Nae Tell SMU mom Le leaner] (Kea T Rot R Sele a E=MC? ‘The Math module provides access to a plethora of mathematical Functions, from simply displaying the value of Pi, to helping you create complex 30 shapes. FEPTSEBD The Math modules builtin to Python 3;0 there's noneed to PP instal t.As with the other modules present, you can import the module's Function by simply entering Amport math into the Shell or as part of your code in the Editor. ren 54.3 eta, oct 3h on Lange agi. seredte” or Tanti “License()" for more information, Importing the Wath module wilgve you accessto eu the module's code. From there, you can call up any of the available functions within Math by using mati, followed by the name of the Function in question. For example, enter: math.sin(2) This displays the sine of 2. (3 Sey ESTEE ’svouwil no doubt be aware by now, ifyou know the name of the individual functions within the module you can specifically import them. For instance, the Floor and Ceil functions round down and up a oat: Hype, “conyrighe®. “credits” or “Iicense()* for more information BE" rsrmath import Heer, ceil 33> HoorGs2) > este. ‘The Math module can also be renamed as you Import, as withthe other modules on offer within Oia Python. This often saves time, but dant Forget to make a comment to show someone else looking at your code what you've done: import math as m m.trune(123.45) # Truncate renoves the fraction ben 2 z cyte eee 19 2OTe, TTD Hype SceeyageMereditas or “icanee* for more information‘Although i's not common practise, itis possible to import Functions from a module and rename them. Inthis example, we're importing Floor From Math and renaring it to Although where lengthy code isin us, this process can quickly become confusing: Type “eopytaghe"."“eredits” or “License()” for more information. p38 csaPmath insert Floor ar oo a EEE porting al the Functions ofthe Math Module can bbe done by entering: ‘from math import + \Wwhile certainly handy, thsi often frowned upon by the developer community asittakes up unnecessary resources and isn't an efficient way of coding, However, iF works For you then go ahead. Tz (aefaule, oct 18 2048, 13:17T) tion tinue » ES Sis Interestinaly, some Functions within the Math moddle are more accurate, orto be more precise are designed to return a more accurate value, than others. For example: a TT will return the value of 0 999999999, Whereas: es mm rm 1) returns the value of 1.0, ys ergdits” or “License()* for more information ‘nore i - iss 1. oy Using the Math Module (5 Sia) precise values: For further accuracy, when it comes tonumbers the ‘exp and expmt functions can be used to compute 2 (Gefault, Oct Tee ast on line fp cenyrigt? “credit or “Licens()" for more information. Pe mma art ep opm eosoBSooabssetve-05 sSeempane3 ; Se - ESTEE Tislevel of acuracyisrealy quite impressive, but 4uite niche for the most part. Probably the two most used Functions are e and Pi, where isthe numerical constant ‘equal to 2.71828 (where the circumference ofa circle is divided by its diameter} (ce 4.9:1) on tinue Hye cepytapne”. “ereaite” or “License()” for more information 2 oor math Pnkimtaseasnoes ‘The wealth of mathematica functions available through the Math module s vast and covers. ia) ‘everything from Factors toinfnity,powersto trigonometry and angular conversion to constants. Look up https:/docs.python.ora/3/ Uibrary/math.htmit for alist of avaliable Math module Functions.Evins Random Module Rasen Mu eeu eke tere Na aN et Ter programming lifetime; as the name suggests, it’s designed to create random numbers Cola ee Tea oO Maoh 2c Cen IaTs (one a TL AeA OOOO RANDOM NUMBERS There are numerous Functions within the Random module, which when applied can create some interesting and very useful Python programs. Just as with other modules you need to import random before you can use any ofthe Functions we're going to look t inthis tutorial Let's begin by simply printing @ random number from 1 to 5: print (xandomint (0,5)) oe at ot og tee zo ep ED | curexample the number four was returned, However, enter the print function a Few more times andit wil display different Integer values From the set of ‘numbers given, zero to ive. The ‘overall effect, although pseudo- Fandom, is adequate for the average programmer to utlse in their code. FERED Fora bigger set of numbers, including floating point values, vou can extend the range by using the ‘multipication sign: Amport random print (random. random() #200) \will display a Floating point number between 0 and 100, tothe tune (of around Fifteen decimal points. Sew “an re ti ol Bee tiowever, the Random module isn’t used exclusively For numbers. You can use it to select an entry from 3 lst From random, and thelist can contain anything: ‘This will display one ofthe names of our adventurers at random, ‘which is great addition toa text adventure game. Bg a ‘Youcan extend the previous example somewhat by cues having random.choice() select from a list of mixed variables. For instance: ——eeeeeRandom Module 4 Interestingly, you can also use a function within the Random module to shuffle the items in the ist, thus adding alittle more randomness into the equation random. shuffle(1st) print (ist) ‘This way, you can keep shuffling the list beFore displaying a random item from it. Using shuffle, you can create an entirely random lst ‘oF numbers. For example, within a given range: Sis import random ete [i] for T in range (20)1 yandon.ehuffle(1st) print (let) Keep shuffiing the list and you can have different selection of items From 0to 20 every time, You can also select a random number from a given range in steps, using the start, stop, step loop: import random for i in range(10): print (random.randrange (0, 200, 7)) Results will vary but you get the general idea as to how it works Let’s use an example piece of code which fips a G1) virtual coin ten thousand times and counts how many times it wil land on heads or tals: coinelist (output -keys()) for 4 dn range (10000) + output [random. choice (coin) ] += print (*Heads:", output [*Hleads*]) print ("Taile:", output [*faile"]) Here's an interesting piece of code. Using atext File containing 466 thousand words, you can pluck ‘a.user generated number of words From the file (text fie Found at: ‘wwe github com/dwylfenglish-words): import randon print (*s>>s>>ss>oRandom Word Finderce
File) and create aTrue/False while loop: import pygame import pygame pygane.init () from pygane. locale import * pygame. init () ‘ganewindowspygane. aieplay-set_node ((600,600)) pygane. display.set_caption("Adventure Gane") runningstrue while running: for event in pygane.e Af event .type==QUIT: running-False Pygame quit () le Edt Famat Bin Qptions Windows He =r pore pyeane ifs prgmerocals apt © PPIIPDD Ler’: create asimple game ready window, and give itatite: ganewindow-pygane. display.eet_wode ((800, 600) ) pygane. display.set_caption (*hdventure Gane") gumerindon-pygane display set node((800.600)) Prose display-set-coption( Adventure cane") (ost emma rates You can see that after the fist ine is entered, you need to click back into the IDLE Shell to continue entering code; also, you can change. the title of the window to anything you tke(Pygame Module [> EEE ithe Pygamewindowstil won't = close don't worry, it'sjust a discrepancy between the IDLE (whichis written with Tkinter) and the Pygame module. If you un your code va the command ine, it closes perfectly well FERED) You're going to shift the code around abit now, running the main Pygame code within a white loop; tmakes it neater and easier to Fallow. We've downloaded a graphic to-use and we need to set some parameters for pygame: import pygane pygame- init () sunning-Teue while sunning gamewindowapygane. @isplay.set_node ((600,600)) pygane.display.set_caption(*Adventure Game") black=(0,0,0) whites (255,255,255) BR ccvoinconconcceua nce ED secre cece Faro preme ron pygame Locals import * ganenindow-pygune. display set_mode((800,600)) Preme display set-caption(-saventore. cone") Blscee(0-0°03, vntten( 255,295,255) “ngspyeane nage load(“/hone/ps/Donnloads/sprite).png") dot spratece.y): Himenindon 1St¢img, (4.99) ingepygane image. lead (*/home/pi/Downloade/ epritel.png") def aprite(x,y) ‘ganewindow.1it (ing, (x,¥)) x=(800*0.45) y=(600%0.8) gamewindow. £411 (white) sprite(x.y)
[email protected]
() for event in pygane.event .get() Af event .types=pygame. QUIT runningsFalse downloaded image called sprite1.png and allocated it to the variable img; and also defined a sprite Function and the Bit Function wil allow us to eventually move the image. gmenindon.fillovhite) Spritecsy) Prame-display.update() ‘or event in pygane event. get0) SF event Rypersqutr unninger aise prame-auiti@) Using Modules BaTeeR AD ow we can change the code around again, this time containing 3 movement option within the while loop, and adding the variables needed to move the sprite ‘around the screen: Amport.pygame from pygame.locals import * pygame. inst () unning-True ganewindowspygane. display. set_wode ((800, 600) pygane.display.set_caption *Adventure Gane") black=(0,0, 0) whites (255,255,255) ing=pygame . image. load (*/home/pi/Downloads/sprit pn") def sprite (x.y): ‘ganewindow.bLit (img, (x,y) x= (600*0.45) ye(6000.8) xchange’ Af event type == pygame.KEYDOHN: Af event .keys=pygame.K LEFT: ‘gamowindow. £11 (white) sprite(x,y) pygame.display update () pygame quit () Tene RD (0Py the code down and using the left and right arrow keys on the keyboard you can move your sprite across the bottom of the screen. Now; it looks ike you have the makings ofa classic arcade 20 scroller in the works. War ese: Evans. cor(Pygame Modules [> BEER You con now implement afew additions and utilise pygane.display.£1ip() some previous tutorial code, The new elements are clock. tick (60) the Subprocess module, of which one function allows us to launch a continue second Python script From within another and we're going tocreatea break [New File called pygametxtpy pygame.quit () import pygane import. time import subprocess pygane. init () screen = pygane.dieplay.set_mode((800, 250)) clock = pygame.time.clock () ie artis: font = pygane. font Font (None, 25) pygane. time. sot_timer (pygane.USEREVENT, 200) dof text_generator (text) tmp = *7 for letter in text: tmp ¢= letter Af letter I= * + yield tmp class DynamicText (object) def _ init__(self, font, text, pos, arr a sutoresct Palas) aaa ol. o ree, st fant. censer at, 9. 128, 0) jeuianlenet rst mrt 0 fee | Sa et ac peu unaptrounsryoon’ssenspstey lire self ,_gen = text, generator (eelf.text) POS = Pos Sree ieiett reneres, seit pony autoreset = autoreset BOS easing estsipaep a mee peepe ‘update () eee ian ee 2s) — ‘self,_gen = tent_generator (self text) a self done = False ee toys cerca 848°) self update () det update (seit) Af not self. done: try: self rendered - self. font. PETER When yourun this code it wll isplay along, render (next (self._gen), True, (0, 128, 0)) narrow Pygame window with the intro text except Stopiteration scrolingto the right. After a pause often seconds, itthen launches aelf.done = True the main game Python script where you can move the warrior sprite ‘time.sleep(10) around, Overall the effects quite good ut there's always room subprocess.Popen|"python3 /howe/pi/Decumants/ _forimprovement. Python\ Code/pyganel.py 1", shell=Trus) def draw(self, screen) screen.blit (self rendered, self.pos) text=("A long time ago, a barbarian strode from the frozen north. Sword in hand. ..") message = DynamicText (font, text, (65, 120), autoreset True] while True: for event in pygane.event .get () Sf event type == pygame.QUIT: break Af event type == pygame.USEREVENT: message: update () else ‘nessage.draw(screen) ‘screen. £11 (pygame.color.Color (‘black')) %Evins Basic Animation Python's modules make it relatively easy to create shapes, or display graphics and EUnet UeMgt en aaron m mended saa Coole UNCER ecu OTe Ree UCR een od Ten Meron ete clu CHA LIGHTS, CAMERA, ACTION The Tkinter module is an ideal starting point for learning animation within Python. Naturally, there are better custom modules cout there, but Tkinter does the job well enough to get a grasp on what's needed. PEPER
EATER Now you're going to take the Function definitions ‘out ofthe program and into a separate ie Highlight the Function definitions and choose Edit > Cut. Choose File > New File and use Edit > Paste in the new window. You now have two separate files, one with the Function definitions, the other with the Function calls \F you now try and execute the basic_math.py code ‘again, the error‘NameEsror: name timestwo' is Oiag not defined’ willbe displayed. Tiss due to the code no longer having access to te function definitions. TEED Retunto thenewly created window containing the Function definitions, and lick File > Save As, Name this, minimath.py and save tin the same location as the original basic_math.py program. Now ‘lose the minimath py window, so the basic_math.py window is leftopen.PPT (2k to the basic_math.py window: at the top ofthe code enter: from minimath import * ‘Thiswillmport the Function definitions asa module, Press F5 to save and execute the program to seeitin action, Sis You can now use the code Further to make the program alittle more advanced, utilising the newly created module tots Full Include some user interaction, Start by creating a basic menu the user can choose from: print ("Select operation.\n") print (*1.Times by two") print (*2.Times by Three") print ("3 .square") Brint (*4.Power of") choice Anput (*\nBnter choice (1/2/3/4):*) Now we can add the user input to get the number the code will wark on: unt = int (input (*\nEnter number: *)) ‘Thiswillsave the user-entered number as the variable num | Ble Edt Format Run Options windows Help Tron minimath Inport * print("select operation.\n") | pncr re by two") jrint("2.Tames by Three") irint("3.Square") Print("4.Poner of") choice = input "\nénter choice (1/2/3/4):") punt = intCinput("\nEnter number: ")) (Create Your Own Modules [> Finally, youcan now create arange off statements to determine what to do with the number and utilise the newiy created function definitions: _ Print (timestwo (num) ) Lf choice == elif choice == 12 Print (timesthree (mum) } elif choice == 43": ‘print (square (num) ) elif choice = “4's pun? = int (input (‘Enter second number Print (power (num, mum2)) else: print (“Invalid input*) ‘le Est Frm Grenson Hey wy Note that forthe ast valable options the Power Sui of choice, we've added a second variable, num2. Tis pases asecond number trough the function definition cle power Save and execute the program osee kin ationPython in Focus: Artificial Intelligence Artificial Intelligence (Al) and Machine Learning (ML) are the new hot topics of the IT iret en Acca eel Reale Rre(ule Meee naa] a apr cd elle eter eT) faded Cel dee Despite how close Al and ML are, there are distinct differences between the two technologies. Alrefers tothe study of how to train a ‘computer to accomplice the things that humans can do significantly better and Faster. Whereas, MLsthe ability For a computer to learn ee ee usa eventually become more accurate and accomplished Pc eee ee ed clement: training a system tolearn and do things independently. Rear eer a ce ce ed and, thanks to Python, that gap is getting loser every day. Both Al and ML are hugely present in today’s technology. Where, ene ese ey ere a ea ae eet et een] eee ater e arr) eee Fee og eas See ete setae
File and save it as FileMan.py. Once executed it will display the program title, along with the current time and date and the available options. | smport snutsr | | import os L [import tine t “import sumprocess _| ee Read): patheinput("Enter the file path to read:") —) ‘losopen(path,"r") | printiaie read) b dee writed patheinpat(’Enter the path of file to write or create:") S£ o8.path.safile(path) print('Rebuilding the existing Mie") alse: rint(‘Creating the new file’) text=input ("Enter texts") ‘Mlesopen(path,"w") Sle write(text) dot aad patheinput("Enter the file path") text=input (‘Enter the text to add") ‘Mlesopen(path,"2") ‘Mle.write(\n'ttext) dot delete) patheinput("Enter the path of file for deletion:") {Lf 0 -path.exista(path) rint(‘File Found’) ‘8 renove(path) Eint(‘File has been deleted’) else: Eint('Pile Does not exist’) dor pinist() patirinput(’Enter the Directory path to display:") sortlistmsorted(os.1istdir(path)) ino waile(icten(sorttist)) rint(eortlisttil+'\n) Seed dee checks) fpeint(input ‘Check existence of \ni.File \n2. Dizectory\n')) Af fps: patheinput("Enter the file path") ‘oe-path,dsfle(path)Af 0 path tanta patn)—tzue: rint(‘File Found’) PEint(‘File not found’) LE Epeet: path=input ("Enter the directory path:" fs path dedir(path) Lf os path isdir (path)enFalse: Print (‘Directory Pound’) [Print(‘Directory Not Found’) dee Move() ‘pathininput(‘Enter the source path of file to move: ‘e-int(input(/1 Rename \n2.Move \n')) ‘ath2uinpat(‘Enter the destination path and fle nane:’) ‘hutil nove(patht path) print(File renamed’) Af mrmet: Path2~input (‘Eater the path te move:') shutl nove(path1,path2) Print(‘File moved’) det copy) ‘pathieinput(‘Enter the path of tho file to copy or ronane:") path2ainput(‘Enter the path to copy to:’) ‘hut copy path path2) Print(‘File copied’) dee Makedix( ‘patheinput("Enter the directory nase with path to make \nog. CA\Welto\Wewdte \niere Nowa i= now atzectory:") os.makedirs(path) Print (‘Directory Created’) dof Ronovedir(: pathainput('Enter the path of Directory:') ‘treedir=int (input('L Deleted Dizectory \n2.Delete Directory Tree \n3.Exit \n!)) os mnair(path) Af troedixen shut rmtree(path) print( ‘Directory Deleted’) Af troedixen: exito, ‘dof opensiiev) patheinput('Enter the path of program’) try: on startale(path) PEIne(File not found’) whtteqrune) try: of. system close’) except Osteror: os.systomt cls") print (\\mspooosspobython 3 ile Manager
number: rint(‘Too high, try again.’) Af guess = number: break quessestsed = str(guessestsed) Print('Well done, ° + Name +‘! You guessed correctly in * + guesseslsed + * guesses.’) al EBS ace eet os rial eo Af quoss != number: number = str(nunber) Eint((Sorzy, out of guesses. The number I was} | thinking of is + number) I 0 ‘ah youeed to porthe andommedie ayo sng Svan nunberstn toe Oe This section ofthe code creates the variables forthe number ‘numbersrandom.randint, 30) remake it too high though orthe player wil o.quessit IF the player quesses too low ar too high they are given appropriate output and asked to try again wile the numbe (of quessesis less than Five. You can also increase the number of {uesses from 5 by altering the while quessesUsed <5: value, fib payer unscaot ass hate gue ove ODE delayed sta, ong th revel the mbar the como. wartngot Remember. 304 doar he tes he Tundom ruber hen bye compar or te ube ues the payer cantae.hen ong with the arable ues, youaoneedtoan ctonsgeninthe pn eee) ed a Nee esCode Improvements Since this is such a simple script to apply to astuation, there's plenty of raom to mess around with itand makeit mare interesting. Perhaps you can include an option to take score, the best out of three rounds. Maybe an elaborate way to congratulate the player for getting a hole in one’ correct. quesson ther First try Moreover, the number guessing game code does offer some room forimplementing nto your code na different manner. What ‘we mean by thsi, the code can be used to retrieve a random number between arange, which in tum can give you the start of a ‘character creation defined function within an adventure game, Imagine the start ofa text adventure written in Python, where the player names their character. The next step isto roll the virtual random dice to decide what that characters combat. rating, strength, endurance and luck values are. These can then be. cared Forward into the game under a set of variables that can be reduced or increased depending onthe circumstances the player's character ends up in ( Number Guessing Game For example, as per the screenshot provided, you could use something along the lines of creo ‘Endurance = random randint(2, 18) (CR = random.zandint(1, 20) ek = randon.canaint(l, 10) Print ("Your character's stats are as follows:\n") Print (*Endurance:*, Endurance) Print(*Combat Rating:", CR) Print ("huck:", Luck) ‘The player can then decide to elther stick with thei roll or try again forthe hope of better values being picked. There's ample waysin which to implement this code into abasic adventure game. =Cer Deity ee AUSTat ayo) Ler- 1p ea-R-) >) Lato) Mee Aucian tee letechls elements with any programming fetettcte leer secur cs a good program from a great Frere M ant lel ONS en Meo rod fl Ie leee yeh a Te ele that interaction: More Input hile an easy code to follow, itcould be more interesting if you prompt the user For more input. Perhaps you can provide ther with adaition, subtraction, multiplication elements with their numbers. IFyoue feeling clever, see if you can pass the code through a inter window or even the Ticker window that’s _2yaliable on Page 128, Furthermore, the core ofthe code can be used inatextadventure ‘game, where the character Fights something and ther health ‘along with the enemy’, reduced by a random number. This canbe mixed with the previous code from Page 90's Number Guessing Game, where we defined the stats forthe adventure ‘game's character, aera eal ‘You can also introduce the Turtle module into the code and perhaps set some defined rules fr drawing a shape, objector ‘something based on a user inputted random value from a range ‘of numbers. takes little working out butthe effect certainly really interesting ee) dT) eee) RNDNUMGEN.PY ltmight be simple but this litle piece of code will ask the user For two sets of numbers, a start and a finish. The code will then pluck out a random number between the two sets and display it. from random import + pint (*\n>ssoosp99Random Munber Generatorccccccecce\n") nmbi=int(input("Enter the start number: ")) mb2=int(input(*Enter the last munber: ")) X= randint(amb1, nmb2) [Print(\nfhe random munber betwoon” nb, ’and”,nmb2,"is:\n") printed For example, the code could be edited to this: ‘from random import * printi(\n2ossp>2>Random Turtle Imagecccececcce\n") imbinint(input "Enter the start number: )) mb2nint(input (“Enter the second munber: °)) nb3eint(input ("Enter tho third number: ")) mbé-int(input("Enter the fourth minber: ")) ‘turtie.forwardtambt) turtie-ieft(90) ‘turtle. forvard(nmb2) turtie.2eft(00) turtle forvard(ambs) ‘turtle.1eft 00) ‘turte.forvardtambs) turtle. lett 90) ‘Whilst t's alittle rough around the edges, you can easily make'lt more suitable,(_Random Number Generator/Password Generator Random Password Generator We're always being told that our Passwords aren't secure enough; well here’s a solution for you to implement into your own future programs. The random password generator code below will create a 12-letter string of words (both cases) and numbers each time it’s executed. Secure Passwords. There's plenty you can de to modify this code and imprave it Further. For one, you can increase the numberof characters the ‘generated password displays and perhaps you can include special characters too, such as signs and symbols. Then, you can output the chosen password to afl, then securely compress it using the previous random number generator asa file password and send it toa user For their new password. ‘Aninteresting aspect to this codes the ability to introduce loop. {and print ary numberof random passwords. Lets assume you have. alistof 50 users for acompany and you're in charge of generating ‘random password for them each month. RNDPASSWORD.PY Copy the code and run it; each time you'll get a random string of characters that can easily be used as a secure password which will be very dificult For a password cracker to hack. Amport string import random def randompassword(): charswstring.ascii _ uppercase + string.ascii _ lowercase + string digits size @ return “'join(random.choice(chars) for x in range(size,20)) ‘print randompassword()) ‘Adding a loop to print a password fifty timesis extremely easy, for example: sport string import random def randompassyord): charsestring.ascti _ uppercase + string.ascii _ lowercase + string digite sizes 4 return “ jein(random.choice(chars) for x in ange(size,20)) mo white neso: This will output fifty random passwords based on the previous random selection of charactersTXT2BIN.PY <9 _ acca ih ae rt ee ae ences es erali Soeur dS Benepe tae le Cohan ST Nella ges odes tee Tienes Brae tale , EE hitea cot Naturally we're using the format Function to convert the user's entered text string into its binary equivalent. If you ‘want to check its accuracy, you can plug the binary into an online convertor, nas} i Pa eint(’ ‘jein(format(ord(x), ‘b’) for x in text)) fala eget erg ee ee tae i Role ee er ey - At Prtiat /bocuments/Python Code $f eel ed al) Bile Edit Format Run Options windows Help print(">>>>>>>>>>Text to Binary Conver tor<<<<<<<<<<\n") text=input(“Enter text to convert to Binary: ") print(* *.join(format(ord(x), "b') for x in text)) Nm Ete ed(Text to Binary Convertor (4 1000010 1101001 1101110 1100001 1110010 1111001 ‘The text to binary corwertor does offer some room For on improvement and enhancement. There are many uses:itcouldbe _/PY¥amesSienlay.set.—caption(rainary Conversion’) ublisedin a password or secret word script, as partof an adventure dong = False ‘game oF just a novel way to display someone's name, clock = pygane.tine.clock() Rigo oh Cac Vr another go, or even ask if they wanted the binary output to be eT Sore —— React erry reece acre se a eee Se — —_ SS a ee oe es === es SS [print((>o>sspoootext to Binary Convertorccccce
= 0") sye.oxit(0) Af minutes < 0: print ("Invalid value for minutes, should be > ‘Windows users, Python 3s the only version installed on your sys.exit() system then you willneed to execute the code without adding the 3to the end ofthe Python command. For example: seconds = minutes * 60 python Alarmclock.py 10 s¢ minutos miter ‘Again, you could easly incorporate this into’a Windows batch a eee pre Ste eater - tines ofthe dy. * minute”uf i PI $ G im i 0M a .@ BT @z Serer! Nm ed What's not to like about vertically ere ape ly Scrolling Text Praca ntepe alates ae nae beginning of a game or introduction RoR Mn Neh soced Rant Moltel(aaTiaTe} of every Star'Wars movie; a list of credits at the end of something} such redeem aa folol-y oI} a) erat el ea ewe) eh eee cs Per ory p De ee) eee eee EPICSCROLL.PY We've used the poem Cimmeria by Robert E. Howard for the code's scrolling text, along with a dramatic black background and red text. We think you'll agree, it’s quite epic. from pygame.locals import * pg.inito, text _lit = 1 remember ‘he dark woods, masking slopes of sonbre hills; ‘The dusky streams that flowed without a sound, And the lone winds that whispered down the passes. Vista on vista marching, hills on hills, Slope beyond slope, each dark with sullen trees, ur gaunt land lay! So when a man climbed up A rugged peak and gazed, his shaded eyo Slope beyond slope, each hooded like its’ brothers, Tt was a gloony land that seened to hold All winds and clouds and dreams that shun the sun, With bare boughs rattling in the lonesome winds, And the dark woodlands brooding over all, Not even lightened by the rare dim sun Cinmeria, land of Darkness and deep Night. twas so long ago and far amay T have forgot the very name men called me. ‘The axe and flint-tipped spear are ike a dean, And hunts and wars are shadows, I recall Only the stillness of that sombre land; ‘The dinness of the everlasting woods. Cimmeria, land of Darkness and the Right, Oh, soul of mine, born out of shadowed hills, How many deaths shall serve to break at last This heritage which wraps me in the grey Apparel of ghosts? I search my heart and find Cimmeria, land of Darkness and the Night! wr gplse cn’)class Credits: dof __ init__(self, screen_rect, ist) selelet = let self.size = 16 self.color = (255,0,0) self.baff_centery self.buff~ lines = 50 self-delay = 0 self.nake_surfaces() self.srect-height/2 + 5 dof make _toxt(self message) font = pg.font.SysFont(Arial’, self.size) text = font render (eessage,True,self.color) rect = text get _rect{center = (self srect, centers, self.ercct.centery + self. buff _centery) ) def make _surfaces(se1s) self.taxt =O) for i, Line in enunerate(self.1st): ‘1m selé.make _text(line) Aly 4 itselE bute lines self.text.appenda) def update(sels): Lf pg.tine.get _ ticks()-self.timer > self delay: self.tiner = pg.time.get _ticks() for text, rect in self.text: recty -= 1 def render(self, surf): for text, rect in self.toxt: sare blit(text, rect) screen = pg.display.set _mode((800,600)) screen _rect = screen.get _ rect) clock = pg-tine.clock() running=Truo cred = Credits(ecreen rect, text _ list) for event in pg.event.get() if event.type = QUIT: screen.fi11((0,0,0)) cxed.update() cred render(screen) pa.display.update() clock tick(60) ( Vertically Scrolling Text ALLong Time Ago. The obvious main point of enhancementisthe actual text Itself Replace it with list of credits, or an equally epic opening storyline to your Python game, and twill certainly hitthe mark with whoever plays it Don’t forget to change the screen resolution f needed; we're currently running itat 800 x600,BNarseer te Ls lease a DIGCLOCK.PY No ae ud This sa surprisingly handy little script and one that we've ESV clus Ue ete] Neh ACORN (3 used in the past instead of relying Sp awatitceent Oe ere rary clock in the system tray ofthe operating system. Tear sa Roa sapere tine a Python digitalclock thatican be a Coo} y-1al lolol. ate) RULe(el fol ol nt got the curvent tine fron the FC timed = time.steftine( WHS") Sf time? t= times: tinol = time2 clock.config(text=time2) clock.after(200, tick) oot = Ue7k() ‘tkabel(root, font=(’arial, 20, "bold’), by='green’) clock pack{Gll='both’, expand=1) tick oot aninloop() ea Eee es CI >» eer ee Pere ier T Nm edTick Tock } Thisisa piece of cade we've used many times inthe past to keep track of time while working on multiple monitors and with just a ‘Quick olance to where we've placedit onthe screen ‘The Tkinter box can be moved around without affecting the time, marimised or closed by the user at wil. We haven't given the Tkinter clock window a title, so you can add to that easily enough bysnipping the code from other examples inthis book. ‘Another area of improvement sto include this code when ‘Windows or Linuxstarts soit automaticaly pops up on the desktop. See als, iF youre able to improve Its Functionality by including afferent time zones: Rome, Pars, Landon, New York, Moscow and son. ‘Another example, expanding on the original code, could bea:
>>sppoop awesome Adventureccccceccc<\n") Peint("\n" * 3) tine.aleep() Eint(*\nA long time ago, a warrior strode forth from the frozen north.”) ‘time sleep() PEint("Doos this warrior have a name?”) ame=input ("> *) print(nane, “the barbarian, sword in hand and locking for adventure!”) time.sleepQ) Print(‘However, evil is lurking nearby....") ‘imo. sleep() rint("A pair of bulbous eyes regards the hero...") time.sleep(2) PEint(Will", name, "prevail, and win great fortune...”) tine,sleep() Eint(‘Or die by the hands of great evil...2") ‘ime. sleep() eine(*\n" #3) pein (‘Only time will tell...”) ‘time. leep(2) eine.) ‘time.aleep() print(’..) tine,sleepC) time. aleep(5) PEint(*\n" #200) peint(\”’ You find yourself at a small inn. There's Little gold in your purse but your sword is sharp, With you are three other customers, A ragged looking man, and a pair of dangerous looking guards."”) dor start peint(*\n — -") Print(‘Do you approach the...”) ") reins fied tne erone tock ne Tome) endlist=(1", °2") end-getond(endlist)dof guards(): rint(’\n” *200) Print(’You walk up to the dangerous looking guards and groct them. The guards look up from their drinks and snarl at you. What do you want, barbarian?” One guard reaches for the hilt of his sword...’”) time.cleep@) Adventure Time ‘This, asyou cansee,s just the beginning of the adventure and takes up afar Few tines of code, When you expand it, and weave the story along, youll Find that you can repeat certain instances | such as a chance meeting with an enemy orthe Uke. We've created each ofthe two encounters asa defined set ‘of Functions along witha list of possible choices under the ‘emai list, and cmd variable, of which is also a defined Function, Expanding on thisis quit easy just map out each encounter and choice and create a defined Function around it. Providing the user doesn't enter quit into the adventure, they can keep playing. ‘There's also roomin the adventure fora set of variables designed Far combat, luck, health, endurance and even an inventory or ‘amount of gold earned. Each successful combat situation can Feduce the main character's health but increase thei combat skis, ‘or endurance. Pls, they could loot the body and gain gold or earn ‘gold through quests. Finally, how about introducing the Random module. This wl ‘enable you ta include an element of chance inthe game. For ‘example, in combat, when you stike an enemy you willdoa random amount of damage as will they. You could even work out the maths behind improving the chance ofabetter hit based on your oryour opponent's combat ski, current health, strength and, ‘endurance, You could create a game of dice inthe inn, to see if you win or lose gol (again, improve the chances of winning by working ‘out your luck Factor into the equation Needless to say, your text adventure can grow exponentially and prove tobe a work of wonder. Good luck, and have fun wth, your adventure. ( Text Adventure Script elif ond == "help": print(*\ninter your choices as detailed in the game." Print(‘or enter ‘quit’ to leave the game”) return gotond(cndlist) elif end == "quit": print (*\n- time.sleep(2) print ("Sadly you return to your homeland without, 49aya er pe ee Oey er Nee ad ty t is \ Ci eed Eee ee Python Scrolling Ticker Script You may be surprised to hear that one of thesnippets of code we're ier lle eae scrolling ticker. Whilst we've covered various forms of scrolling text PUA merece ees seuttced asker sah Son evar Ticker Time he obvious improvements to the Ticker code lien the speed of the text and what the text will display Otherwise you can change the backoround colour of the ticker window, the Font and the Font colour, along with the geometry ofthe Tkinter window if you want to. ‘Yet another interesting element that could be introduced s one ofthe many textto Speech modules available For Python 3. You could pip install one, import thenas the tcker displays the text, the text to speech Function will read out the variable atthe same time, since the entice texts stored in the variable labelled 's ‘The ticker example can be used or system warnings, perhaps something that wil display across your work or home network detailing the shutting down of a server cover the weekend for maintenance; or even just to inform everyone a to what's happening. We're sure you will come up with some good uses Fort. TICKER.PY We're using Tkinter here along with the Time module to determine the speed the text is displayed across the window. import time import tkinter as te oot = Ue7k() canvas = tk.canvas(root, root.title("Ticker Code”), hheight=80, width=600, bge"yellow") ccanvas.pack() font = (‘courier', 48, ‘pola’) oxt blocks insert here... a1 = “this ie a scrolling ticker example. As you can soo, it’s quite long but can be a lot longer if 22 = “We can even extend the length of the ticker message by including more variables..." ‘the code. * 4 = “Don't forget to concatenate thom all before the 4 pad front and end of text with spaces # concatenate if all Stal + a2 + ad + ah +05 ‘text = canvas.croate_text(x, y, anchor~'nw', text=s, horizontal movement only 4 the pixel value depends on dx, font and length of text pixels = 9000 for p in range(pixels) # move text object by increments dx, dy # dx —> right to lest canvas.nove(text, dx, dy) canvas.update() # shorter delay ~-> faster movement. tine. sleep(0.005) fprintin) # test helps with pixel value oot.mainloop()Python Scrolling Ticker Script/Simple Python Calculator Simple Python Calculator Sometimes the simplest code can be the most effective. Take For example, this Simple Python Calculator script. It’s based on the Create Your Own Modules, section seen earlier but doesn’t utilise any external modules. CALCULATOR.PY We created some Function definitions to begin with, then lead ‘onto the user menu and inputs. It's an easy piece of code to follow and as such can also be expanded well too. print ("----------Simple Python Calculator-— dof addtx, ¥): return x+y dof subtracts, vit return x - y dof multiply(x, y): return x * y dof divides, yi: print ("2 subtract”) print (‘3.Maltiply”) print (“4.Divide”) ‘choice = imput(*\ntnter choice (1/2/3/4):") ‘muni = int(input(*\ainter frst number: °%)) ‘mum2 = int(input(Enter second number: ")) Af choice == V: ‘Print uum,"4")mum2,"=", ad(mum2,mun2)) elif choice == 2: print(numl,"-"jmun2;"=", subtract (num1,nun2)) elif choice == 9: print(num,"*",nun2,’=", multiply (muni mun2}) elif choice == 4": ‘print num,"/";mum2;"=", divide mumi,mum2)) else: ‘peint("Invalid input”) ti 6 toma tn Sens doe Ie Improved Calculations ‘The obvious contender for improvement here is using the Create Your Own Modules route and extracting the Function definitions as a module. You can then cll the module and Focus fon the body ofthe code, The other area of mprovementis code itself Where there's Justa single shot at making a calculation, you could encase itn awhile loop, so once a values presented the user is sent back tothe main menu. Perhaps, improvement to the Invalid Input sections worth looking into as wellROM UC MEET r la once into Python. It can be extremely complex, displaying graphics, the number of guesses left in the sécret word, a\huge bank of available words picked at random and countless other elements. It can also-be quite simple: Here we-have a mix between ea Eee es CI >» er Nm Ete ad HANGMAN.PY We've made a Hangman game board (the gallows) out of characters that can be displayed in the IDLE Shell, along with a huge bank of words to randomly choose from. import random board = (”" >pppppppplangmancccececkclass Hangman: def __ init _ _(self,word): selEword = word self.nissed letters = () self.guessed_letters = (1 def guoss(sel£ etter): Af letter in selfword and letter not in self. ‘guessed _letters ‘self.guessed _ letters append(letter) elif letter not in self.word and letter not in self.nissed letters: self.nissed _letters.append(letter) else: return False return True def hangman _ over(sel#): return self.hangman _won() or (len(self.missed _ letters) = 6) ‘def hangman _won(sel#): Af \_" not dn self.hide _word0: return True return False def hide _word(eel®): Sas for letter in self.word: Af letter not in self.guessed letters: rin d= else: tn += letter return rtn def print _ game _ status(sel¥) print (Goard{ien(self.missed _letters)}) print (Word: ‘+ selfhide word()) print (‘Letters Missed: *,) for letter in self.missed_ letters: print (letter,) print 0) print (‘Letters Guossed: for letter in self.quessed letters: print (letter) print 0 def rand _word(: ‘bank = “ability about above absolute accessible accommodation accounting beautiful bookstore calculator clever engaged engineer enough handsome refrigerator opposite socks interested strawberry backgammon anniversary confused dangerous entertainnent exhausted impossible overweight tomperature vacation scissors accommodation appointment decrease development ‘earthquake environment brand environnent necessary Hangman Game Script e luggage responsible ambassador circunstance ‘congratulate frequent’.split() ‘return bank[random.randine(0,len(bank))] dof main(): ‘game = Hangman(rand _word0) while not gane.hangean _over(: ‘game.print _ game _ status() user _input = inpat("\nEnter a Lette ‘gana Guess(user _ input) game.print _ game _ status() 4£ game.hangman won): Print (‘\aCongratulations! You have won! else: Print (\nSorry, you have lost.’) peint ("The word wae * + game.word) Print ("\nGoodbye!\n'’) Since this the last example in our Python code repository, we thought we'd go out witha bang and feature the hangman gallows being drawn with each incorrect quess of the word. Don't worry Fit looks misaligned in the text here, this is merely due to the differences between using the Python IDLE editor and pasting the code into a word processor (which Formats things ciferently) “There's plenty you can do to improve, enhance and expand on ‘what we've presented here. You can include aroutine that returns an errorifthe user enters a number or character. You caninclude extra points for someone who guesses the entire word in one go rather than one letter ata time and you could perhaps add Chopin's Funeral March should you lose the game; Dorsomething celebratory if you win. -—- Consider replacing the bank of wordstoo. They're found under the banklist,and could easly be swapped out for something ‘more difficult: IFyou download waw.cithub.com/dwyenglish words you can find atext document with over 466,000 words. Perhaps you could swap the wordsin the bank to instead read the contents ofthe text ile of rand _word): ‘with open("/hone/pi/Downloads/words.txt", "rt”) as Danke. readlines() return bank(randon.randint(0,1en(bank))]Understandin Linux Linuxis a remarkably versatile and powerful operating eu et eRe cele el Maa cer ET EL) engineering world, in science, space exploration, education, gaming and everything else in between. It's Resear er mene cn Peete eure cnes eee een PO eee ee eet ae Ny eae Ecker ete eaten ae Crear eae tee ce ea such, makes for an excellent coding platform. Regardless of whether you're using a Pi, like us, or a Linux Mint or Re een enc Python learning. Master Linux, master Python, and start engineering your coding future. CoeEE) tne What is Linux? Sees ena ate cn eau eel URE Teute erica veces what exactly is Linux? Where did it come from and what does it do? In a world where AU YinNeCoMUe- Tare Muar Le@ ST CEU ear eel en Ke —
Linus Torvalds, the creator ofthe Unuxkernel. Linux s used throughout the world, ina numberof basic and quite unique uses. While it may look adicaly different From one environment to the next, the actual Linux kernel, can be Found in modern smart TVs, in-car entertainment systerns and GPS, supercomputers, lo devices and the Raspberry Pi. t'sused by NASA, both in the command centre and on-board the ISS, Linux servers power the backbone of the internet, along with most of the ‘websites you visit daly Android utilises components of the Linux kemel, as do set top boxes, games consoles and even your fridge, Freezer, oven and washing machin. Linux isn'tjust free to use operating system. t's stable, powerful and fast, easly customised and requires very litle maintenance. However, t's more than just performance stats; Linux means freedom from the walled garden approach of other operating systems. t's a lively community of ike-minded individuals who want more from their computers without the shackles of price or canfarmity, Linux means choiUnderstanding Linux Using the Filesystem GETTING AROUND To drop into the Terminal, click on the Fourth icon from the left along the top of the Raspberry Pi desktop, the one witha right facing arrow and an underscore. This s the shell, or Terminal older, however in Linux t's always called a directory These are and Downloads and Scratch in Blue. You may also see other items laced inside each other using a “7” character. 50 when you see, fepending on how much you have used yout Raspberry Pl, The home/pi it means the pi directory is inside the home directory. clout code is worth knowing: dtectories are bive while most Files Enter: clear and press return to clean the screen, Nowenter: pwd, _afe white, As you go on you'llsee other colours: executable Files This stands for Print Working Directory and displays home (programs) are bright green, archived files are red and so on. Blue and white are the two you need to ka get start inside your user direc tselFin symbolget back upto the pi mand "cd." Linux bm directory above, also knawn asthe parent directory. Incidentally, a single dot." is used For the same directory. You never use "ed switch to the same diectory but its worth knowing because some ‘commands need you to specify the current directory rectory? By using o dots meansthe EED The “is"and “cd" commands can also be mo ths. Enter: 1g Document = Pictures to view the Fa Pictures directory inside your Documents directory. You can switch to this directory using a Docunents/Pictures; use cd tomove back up tw parent directories STEP 1 STEP2 Es STEP 4Understanding Linux Listing and Moving Files LOOKING AT FILES Operating systems are built on files and folders, or directories if you prefer. While you're used to vie operating systems keep other files out of sight. In Raspbian, you have access to every ile in the system, 9 your own files, most use a command lke Ist". The itafter the command the Jah) _then tbe 1, butfit’s a directory itl beat least 2. This is because s known as the argument, This fs an option that modifies the each directory contains two hidden Files; one witha single dot () ,ehaviour ofthe command, and one with two dots (.) Directories containing Files of other rectories willhave a higher number. EEED ectereictecasiccnecinig EIR vecseee tm vor ects ona ‘dashes, ike ‘dewar-xr-x’ Don't worry about these for now; they a5'permissions' and we'llharacters inthe document. Files and directories an be extremely large and hard to determine, o use “Is Ih". The "h argument humanises the number, making it easier to re SOME COMMON DIRECTORIES: Listing and Moving Fil are listed us in with ory with & dot, unle -gument. Hid Should never stat file or dire hide it. Ty the commant ‘Now that you know how to view the contents of your hard drive you'll start to notice a lot of directories with names like bin, bin, var and dev. These are the files and directories that you are kept away from on 3 Mac, and won't encounter on a Windows PC STEP 1 agers -1an eee Crem ca ens TE eens Dg ene nese yen taking the time to know some of them, eee mas Ere ee Shins for system binaries, which are the programs that make nee ggg CE ene Le eee Cte r= nomeheeaeeesepsg ena cermee ten er rreat eet og «monn pee eae Sen emer te ena) to pace most ofthe documents you create. Don't confuse home ge rete pees co oa]
You might also like
ICT AL Unitwise Tutorial
PDF
No ratings yet
ICT AL Unitwise Tutorial
111 pages
Python Challenge!: Learn To Program Fast in
PDF
100% (1)
Python Challenge!: Learn To Program Fast in
24 pages
Telethon PDF
PDF
No ratings yet
Telethon PDF
247 pages
Python Coding Tricks and Tips - 16th Edition - November 2023
PDF
No ratings yet
Python Coding Tricks and Tips - 16th Edition - November 2023
82 pages
Tricks and Tips - C++ & Python - 16th Edition 2023
PDF
No ratings yet
Tricks and Tips - C++ & Python - 16th Edition 2023
78 pages
Python Coding Tricks and Tips 16th
PDF
No ratings yet
Python Coding Tricks and Tips 16th
82 pages
30 Days of Python
PDF
No ratings yet
30 Days of Python
145 pages
Object Oriented Programming
PDF
No ratings yet
Object Oriented Programming
11 pages
100 Python Tips Tricks 1704521617
PDF
No ratings yet
100 Python Tips Tricks 1704521617
122 pages
Cloud Computing Tricks and Tips - 4th Edition 2020.
PDF
No ratings yet
Cloud Computing Tricks and Tips - 4th Edition 2020.
80 pages
Python Advance Cheatsheet
PDF
No ratings yet
Python Advance Cheatsheet
11 pages
Modul 4 - Function Tuple Dictionaries and Data Processing
PDF
0% (1)
Modul 4 - Function Tuple Dictionaries and Data Processing
20 pages
List
PDF
No ratings yet
List
4 pages
DIY Cozmo Robot Expressions: Technology Workshop Craft Home Food Play Outside Costumes
PDF
No ratings yet
DIY Cozmo Robot Expressions: Technology Workshop Craft Home Food Play Outside Costumes
7 pages
Accenture - Automation - Interview Question
PDF
No ratings yet
Accenture - Automation - Interview Question
46 pages
Answers Document (LTPI Python)
PDF
No ratings yet
Answers Document (LTPI Python)
19 pages
Computer Section 1.1.1
PDF
No ratings yet
Computer Section 1.1.1
17 pages
T5 Searching Algorithms
PDF
No ratings yet
T5 Searching Algorithms
27 pages
Python Control Flow Statements and Loops: Pynative
PDF
No ratings yet
Python Control Flow Statements and Loops: Pynative
16 pages
OCR PGOnline Full A-Level Textbook
PDF
No ratings yet
OCR PGOnline Full A-Level Textbook
378 pages
Tkinter Python - Tela de Splash e Menu
PDF
No ratings yet
Tkinter Python - Tela de Splash e Menu
3 pages
Python Basics For Beginers
PDF
No ratings yet
Python Basics For Beginers
29 pages
Python Cheat Sheet
PDF
No ratings yet
Python Cheat Sheet
11 pages
Floating Point Representation Latest by MR Saem
PDF
No ratings yet
Floating Point Representation Latest by MR Saem
69 pages
Lab Front Sheet - Merged
PDF
No ratings yet
Lab Front Sheet - Merged
112 pages
Digital Dnyan Academy - Best Python Training in Pune - Join Us Today
PDF
No ratings yet
Digital Dnyan Academy - Best Python Training in Pune - Join Us Today
10 pages
Programming Fundamentals
PDF
No ratings yet
Programming Fundamentals
22 pages
01 Introduction To TKinter - Windows, Labels, Entry Boxes, Buttons and Text Boxes
PDF
No ratings yet
01 Introduction To TKinter - Windows, Labels, Entry Boxes, Buttons and Text Boxes
21 pages
NCERT Class 11 Computer Science Algorithms and Flowcharts
PDF
No ratings yet
NCERT Class 11 Computer Science Algorithms and Flowcharts
11 pages
Python Practical
PDF
No ratings yet
Python Practical
16 pages
2022-07-23 Python For Beginners
PDF
No ratings yet
2022-07-23 Python For Beginners
94 pages
Python Learn
PDF
No ratings yet
Python Learn
3 pages
Tag Name Code Example Browser View
PDF
No ratings yet
Tag Name Code Example Browser View
9 pages
Python Programming - Introduction All
PDF
No ratings yet
Python Programming - Introduction All
44 pages
CSC 307 - Computer System Architecture-Elizade 20182019new
PDF
No ratings yet
CSC 307 - Computer System Architecture-Elizade 20182019new
162 pages
1.5 Workbook Finished
PDF
No ratings yet
1.5 Workbook Finished
11 pages
Linux Commands
PDF
100% (1)
Linux Commands
12 pages
Module 3 - Intro To C++
PDF
No ratings yet
Module 3 - Intro To C++
54 pages
400 Python Exercise
PDF
No ratings yet
400 Python Exercise
27 pages
Python Interview Book
PDF
No ratings yet
Python Interview Book
122 pages
Python Codebook by COG Updated - Compressed 1 PDF
PDF
No ratings yet
Python Codebook by COG Updated - Compressed 1 PDF
19 pages
Top-Up Degrees - Entry To Year 3
PDF
No ratings yet
Top-Up Degrees - Entry To Year 3
14 pages
Learneverythingai 1661068200
PDF
No ratings yet
Learneverythingai 1661068200
66 pages
Python Basic
PDF
No ratings yet
Python Basic
109 pages
Tkinter
PDF
No ratings yet
Tkinter
118 pages
Worksheet - Strings in Python
PDF
No ratings yet
Worksheet - Strings in Python
7 pages
File Handling in Python
PDF
No ratings yet
File Handling in Python
1 page
Learn To Program With Turtle
PDF
No ratings yet
Learn To Program With Turtle
34 pages
Grade 5 Chapter 1 The Fish Tale
PDF
No ratings yet
Grade 5 Chapter 1 The Fish Tale
15 pages
Strings in Python
PDF
No ratings yet
Strings in Python
9 pages
Python Notes: Invented By: Guido Van Rossum (1991)
PDF
No ratings yet
Python Notes: Invented By: Guido Van Rossum (1991)
2 pages
Python Programming Language
PDF
No ratings yet
Python Programming Language
11 pages
L 3-Python Collections
PDF
No ratings yet
L 3-Python Collections
57 pages
Windows 10 Tricks and Tips 24 August 2022 - B
PDF
No ratings yet
Windows 10 Tricks and Tips 24 August 2022 - B
85 pages
Yuanliang Lyu - Resume
PDF
No ratings yet
Yuanliang Lyu - Resume
1 page
Introduction To Programing Using Java
PDF
100% (1)
Introduction To Programing Using Java
758 pages
Python Tricks and Tips
PDF
No ratings yet
Python Tricks and Tips
84 pages
??python Tricks and Tips ?
PDF
No ratings yet
??python Tricks and Tips ?
82 pages
Raspberry Pi T&T8 TH 21
PDF
No ratings yet
Raspberry Pi T&T8 TH 21
92 pages
Hello : Projects
PDF
No ratings yet
Hello : Projects
15 pages