•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 456,521 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,802 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 835 | Replies: 5
![]() |
•
•
Join Date: Jul 2006
Posts: 562
Reputation:
Rep Power: 4
Solved Threads: 72
I'm writing a lesson on debugging for my students. They will have already had a lesson on how to read code and do walkthroughs, either manually or using the debugger. They currently know about if, while, types, math operators, and have some experience with but no formal training in functions and methods. (We're finishing ch. 3 of Dawson's Python Programming for the Absolute Beginner).
So the lesson on debugging will emphasize verifying that the code does what it looks like it should do. In addition, we'll discuss common errors (bad indentation; naming a function instead of calling it; off-by-one; infinite loops; etc.).
So: what Python errors cause you fits? Or, do you have any hair-pulling stories to share? Or, do you have any "I had to debug someone else's code and it was a stupid ___ error" stories?
Thanks,
Jeff
So the lesson on debugging will emphasize verifying that the code does what it looks like it should do. In addition, we'll discuss common errors (bad indentation; naming a function instead of calling it; off-by-one; infinite loops; etc.).
So: what Python errors cause you fits? Or, do you have any hair-pulling stories to share? Or, do you have any "I had to debug someone else's code and it was a stupid ___ error" stories?
Thanks,
Jeff
Last edited by jrcagle : Sep 29th, 2007 at 10:39 pm.
Even though Python has // as an integer division operator, I most commonly use the / operator. Right now you can use the / or the // operator for integer divisions, and here is were I get into trouble.
This will change with Python30, there you have to use // for integer division or you will get float division.
Another of my common errors is mismatching the numbers of () or [].
python Syntax (Toggle Plain Text)
a = 4/5 print a # oops the result is 0 and I wanted 0.8
Another of my common errors is mismatching the numbers of () or [].
May 'the Google' be with you!
•
•
Join Date: Apr 2005
Location: Dundee, Scotland
Posts: 12,883
Reputation:
Rep Power: 32
Solved Threads: 305
•
•
•
•
So the lesson on debugging will emphasize verifying that the code does what it looks like it should do. In addition, we'll discuss common errors (bad indentation; naming a function instead of calling it; off-by-one; infinite loops; etc.).
Okay, i dont know anything about python(Im a VB guy) but in VB its always interesting to give someone a equasion which works if they do it by themselves in thier head, but not on the computer, due to operator precedence (BODMAS)
(B)rackets
(O)rder (sometimes called (I)ndicies)
(D)ivision
(M)ultiplication
(A)ddition
(S)ubtraction
e.g
What do you think the answer to 2 + 3 x 5 is?
Is it (2 + 3) x 5 = 5 x 5 = 25 ?
or 2 + (3 x 5) = 2 + 15 = 17 ?
(its actually 17!!)!
Last edited by jbennet : Sep 30th, 2007 at 7:23 pm.
TRY MY SUGGESTIONS AT YOUR OWN RISK
Master of puppets Im pulling your strings, blinded by me, you cant see a thing. Master! Master!
Master of puppets Im pulling your strings, blinded by me, you cant see a thing. Master! Master!
•
•
Join Date: Oct 2007
Location: Pennsylvania, US
Posts: 37
Reputation:
Rep Power: 2
Solved Threads: 3
>>> from __future__ import braces File "<stdin>", line 1 SyntaxError: not a chance
Last edited by maddog39 : Oct 10th, 2007 at 7:14 pm.
•
•
•
•
Haha! Favorite error ever! All versions of python have this "hidden feature." It's obviously making fun at C. : P>>> from __future__ import braces File "<stdin>", line 1 SyntaxError: not a chance
drink her pretty
![]() |
•
•
•
•
•
•
•
•
DaniWeb Python Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- "Cannot find server or DNS Error" (Viruses, Spyware and other Nasties)
- Need Help With Parse Error... (PHP)
- Cannot find server or DNS error (Viruses, Spyware and other Nasties)
- "Cannot find server or DNS Error" (Viruses, Spyware and other Nasties)
- Removed Hotbar but still receiving an error message (Viruses, Spyware and other Nasties)
- Error loading "bridge.dll" (Viruses, Spyware and other Nasties)
- Error in Wrox Book (Perl)
Other Threads in the Python Forum
- Previous Thread: Working with lists
- Next Thread: drawing in python.



Linear Mode