Forum: Python Jul 27th, 2009 |
| Replies: 52 Views: 1,442 I can only assume that you put the indentation level of the if statements so that they were inside the loop. They should be outside of that while loop, like I had in my above code. |
Forum: Geeks' Lounge Jul 24th, 2009 |
| Replies: 22 Views: 1,122 Nav33n is correct. Say hello to Serkan Sendur... if you search around for his posts you'll probably find most non-programming related threads seem to have been polluted with some (at times)... |
Forum: DaniWeb Community Feedback Jul 22nd, 2009 |
| Replies: 28 Views: 2,225 You have my vote. I believe the forums would be filled with a lot less of the "i has homework give me code plz" posts. |
Forum: Python Jul 21st, 2009 |
| Replies: 41 Views: 1,078 Remember that the script executes downwards; it doesn't all happen at once. Things like raw_input also stall until input is given, then the script continues. So this is fairly easy to do; here's an... |
Forum: Geeks' Lounge Jul 9th, 2009 |
| Replies: 43 Views: 2,777 I'm not trying to start slinging shit here, but is this a mutual agreement or are you just putting words into your friends' mouths? Hmm... by the way this isn't a union thing or nothing. Please feel... |
Forum: Python Jul 2nd, 2009 |
| Replies: 196 Views: 88,446 For Python 2.x:
People seem to overlook the usefulness of built-in functions for handling common issues with lists. A lot of times, filter, map, and reduce can easily and efficiently serve typical... |
Forum: Python Jun 29th, 2009 |
| Replies: 8 Views: 427 You can try the built-in filter function. Here's what I tried in the interpreter:
>>> a = [
'filter',
'lol',
'filter',
'lol',
'lol',
'filter',
'lol' |
Forum: Python Jun 29th, 2009 |
| Replies: 3 Views: 244 Yield is for generator functions. Return ends the function and sends back the specified value.
Generators are functions that return iterators, i.e. they 'yield' a value after each iteration of them,... |
Forum: Python Jun 25th, 2009 |
| Replies: 3 Views: 263 PLEASE! Use tags! If you look at your post, you realize your Python code has no indentation anymore, and indentation is a crucial part of Python. I'm not going to bother looking through your code... |
Forum: Python Jun 25th, 2009 |
| Replies: 4 Views: 832 In case you didn't notice, your linedata dictionary has no key "id". Hence you receiving the "KeyError" problem. You need the ID of the column you're inserting this into if I'm correct (I barely... |
Forum: Geeks' Lounge Jun 24th, 2009 |
| Replies: 75 Views: 4,964 Ahahah! Wow, this is just getting a little odd guys (not to mention off topic, what happened to movies? :P) |
Forum: Game Development Jun 24th, 2009 |
| Replies: 0 Views: 423 If anyone is still interested in those old, nostalgic text-based games to run in the console, there's Python Universe Builder by Joe Strout. Yes, it's a dead project as the last release dates back to... |
Forum: Python Jun 24th, 2009 |
| Replies: 2 Views: 231 Got it :D
data = [['4/18/94', '29.125', '442.46'],
['4/19/94', '29.336', '442.54'],
['1/20/04', '75.175', '1138.77'],
['1/21/04', '75.711', '1147.62'],
['1/22/04', '75.595',... |
Forum: Python Jun 24th, 2009 |
| Replies: 7 Views: 349 Which Linux distro are you using? Regardless, if you want a visual editor for wxPython, I'd suggest wxGlade (http://wxglade.sourceforge.net/). It generates nice code but it may take a little getting... |
Forum: Geeks' Lounge Jun 23rd, 2009 |
| Replies: 75 Views: 4,964 Trainspotting
One Flew Over the Cuckoo's Nest
A Clockwork Orange
A Scanner Darkly
Fear and Loathing in Las Vegas |
Forum: Python Jun 22nd, 2009 |
| Replies: 2 Views: 314 Your "items" dictionary doesn't have a key named "o" which apparently you are trying to locate. The line if p.weapon == items[sitem[1]] is basically equating to if p.weapon == items["o"]. That seems... |
Forum: Python Jun 21st, 2009 |
| Replies: 7 Views: 325 I haven't done this in forever, and I'm not on a linux machine at the moment, but I'll try to say what I remembered doing :P
If you originally installed it using "sudo apt-get install ...." then... |
Forum: Python Jun 8th, 2009 |
| Replies: 9 Views: 369 All it does is split the input into a list and save it as b like we did before. As of then, we have a list of numbers, but they are actually strings (e.g. ['3', '4', '10']).
From there, we use a... |
Forum: Python Apr 28th, 2009 |
| Replies: 2 Views: 258 I'm highly confused... so what are you asking to call? Assuming you have the attributes __employee_name and __employee_number on the class this function is a part of, this should run fine...
So I'm... |
Forum: Python Mar 27th, 2009 |
| Replies: 2 Views: 1,173 I would say you could take the input string, and split it at each whitespace into a list. Index 0 would be the function name, and each index after would be the arguments. Like:
cmdlist =... |
Forum: Python Mar 26th, 2009 |
| Replies: 15 Views: 1,605 The variable timesflipped used for the while loop is undefined before the comparison while timesflipped < 100:. This script should just return a NameError and not run.
Here's a fixed version:
... |
Forum: Python Mar 25th, 2009 |
| Replies: 2 Views: 293 Why not keep a list of lists for responses corresponding to each user answer? Such as:
responses = [
["Q1, A", "Q1, B", "Q1, C" ],
["Q2, A", "Q2, B", "Q2, C" ],
["Q3, A", "Q3, B",... |
Forum: Python Nov 3rd, 2008 |
| Replies: 2 Views: 379 All I was able to find was this article, but from what it says, it sounds risky as each platform/distro is quite different and difficult.... |