NewStats: 3,261,915 , 8,175,531 topics. Date: Saturday, 31 May 2025 at 01:30 AM 2u4q3i6z3e3g |
Common good python programming practices you should know (14459 Views)
gbolly1151(m): 9:44pm On Jun 18, 2020 |
iCode2:Sure it will work |
gbolly1151(m): 9:59pm On Jun 18, 2020 |
iCode2:Dont mind my naming
|
iCode2: 10:15pm On Jun 18, 2020 |
gbolly1151:Hmmmm you've so grabbed Python concept. I hope to be like you when I grow up. |
gbolly1151(m): 7:35am On Jun 19, 2020 |
iCode2:It is not about the language, it is about data structure and algorithm sir |
iCode2: 9:12am On Jun 19, 2020 |
gbolly1151:Did you take any course on that or you got to understand it over time? 1 Like |
gbolly1151(m): 1:23pm On Jun 19, 2020 |
iCode2:No course just pdf You can this pdf Data Structures and Algorithms in Python by Michael T. Goodrich 3 Likes |
Predstan: 2:45pm On Jun 19, 2020 |
gbolly1151: I am using one by Rance D. Necaise. Do you have the link to the pdf? |
gbolly1151(m): 3:49pm On Jun 19, 2020 |
Predstan: It should be first on Google search sir |
Predstan: 3:55pm On Jun 19, 2020 |
gbolly1151: Keeps directing me to buy the book. I dont know if its because of my Location |
iCode2: 5:32pm On Jun 19, 2020 |
gbolly1151:Okay thanks. Which area do you major? Web dev or data science? |
gbolly1151(m): 6:08pm On Jun 19, 2020 |
Predstan: Sorry bro...i should have sent the link https://www.google.com/url?sa=t&source=web&rct=j&url=http://predmet.singidunum.ac.rs/pluginfile.php/14584/mod_folder/content/0/Data%2520Structures%2520and%2520Algorithms%2520in%2520Python%2520%255BGoodrich%252C%2520Tamassia%2520%2520Goldwasser%25202013-03-18%255D.pdf%3Fforce%3D1&ved=2ahUKEwiqvev2rY7qAhXS2aQKHYGzDeoQFjAAegQIBhAB&usg=AOvVaw0_J9ADcYtLK-LBzI7uQkuW Or search for Data Structures and Algorithms in Python Michael T. Goodrich Department of Computer Science University of California, Irvine Roberto Tamassia Department of Computer Science Brown University Michael H. Goldwasser Department of Mathematics and Computer Science Saint Louis University pdf |
gbolly1151(m): 6:11pm On Jun 19, 2020 |
iCode2: I really want to specialize in software development (in Blockchain space) 1 Like |
Predstan: 6:19pm On Jun 19, 2020 |
gbolly1151: Thanks Boss.. This is Okay |
iCode2: 8:44pm On Jun 19, 2020 |
gbolly1151:Nice! You're set for it. 1 Like |
gbolly1151(m): 8:50pm On Jun 19, 2020 |
iCode2:Not fully set,but moving closer 1 Like |
rastaxarm(m): 3:17am On Jun 21, 2020 |
iCode2: def _list(items) : return ",".(items) print(_list(spam)) |
rastaxarm(m): 3:20am On Jun 21, 2020 |
|
gbolly1151(m): 3:36pm On Jun 21, 2020 |
REMINDER: bool of empty string is False and bool of any string or character is True '''
|
gbolly1151(m): 2:01pm On Jun 26, 2020 |
How To Use Index Method In List To find the first position of a particular element in a list,index method get you covered; the syntax is list.index(element [,start[,end]]) (start and end are optional) '''
|
gbolly1151(m): 8:49pm On Jun 27, 2020 |
What is sentinel? Sentinel in programming is a value that help to stop the execution of a sequence. E.g
|
gbolly1151(m): 10:14pm On Jun 30, 2020 |
TYPICAL MICRO BUG YOU MUST AVOID IN PYTHON There is often hidden bug that most begginers do encounter when using conditional statement example
""" hmm...but why is the output Male? This is how python evaluate the if statement above. it evaluate from left to right starting with sex == 'M' which return False,then evaluate the result with next condition, False or 'm' which is True, if you are worried how we evaluate bool and str, here is how it works bool('m') return True,so in real sense we are evaluating False or True which make us arrive at True,now sex == 'M' or 'm' result to True which make code under if triggered. the way python see above code is this
to correct the bug, just rewrite the code this way"""
|
gbolly1151(m): 9:23am On Jul 01, 2020 |
ACCESS CLASS ATTRIBUTE IN FEW LINES OF CODE USING VARS() Let assume you have class profile and its attributes, you can access them in two lines of code compare compare to what we know before example: '''
wow we achieve same result in just two lines of code regardeless of the number of attributes Note: side effect of this approch is that,it is unordered ''' |
gbolly1151(m): 7:57pm On Jul 02, 2020 |
DO YOU KNOW THAT else KEYWORD WORKS WITH while AND for LOOP? the purpose of else statement in for and while loop is to get executed when loop ended without break statement
|
gbolly1151(m): 9:21am On Jul 06, 2020 |
HOW TO USE hasattr,getattr AND setattr >>hasattr is to check if a particular object/class has a particular attribute. syntax hasattr(obj,attribute_name), it return True or false >>getattr is use to get the value of an object(function,variable,class and other object), if available else it return AttributeError syntax is getattr(obj,attribute_name) >>setattr is used to set the attribute of an object syntax is setattr(obj,attribute_name,value)
|
gbolly1151(m): 11:37am On Jul 11, 2020 |
KEY DIFFERENT BETWEEN return AND yield IN PYTHON Return - this keyword terminate a function Yield - pause the execution of a function |
gbolly1151(m): 2:37pm On Jul 12, 2020 |
CHECK OUT THIS PYTHON FLOW
|
gbolly1151(m): 1:49pm On Jul 19, 2020 |
|
gbolly1151(m): 7:25am On Aug 11, 2020 |
Quite an age here
|
Predstan: 3:39am On Aug 12, 2020 |
gbolly1151:Yeah, where have you been? I don day use tensorflow |
gbolly1151(m): 4:20am On Aug 12, 2020 |
Predstan:Wao!!!...that is cool bro,keep moving |
gbolly1151(m): 7:39pm On Oct 14, 2020 |
It been a while here
|