Forum: Python Aug 28th, 2009 |
| Replies: 17 Views: 561 That might have worked if done properly, but I couldn't do it.
I passed the course today so thank you again, I'll mark this thread solved. |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 Hooray! I figured out the rest. God bless you guys, you are lifesavers.
If you're interested I changed Competitions().method() to self.method() and put self.old_leader=0 in between the shootings.... |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 As I thought woooee meant:).
It's in the first post but here it is again:
Bob/25/0/0/0
Bill/23/0/0/0
Billy Bob/32/0/0/0
Dick Cheney/34/0/0/0
Harvey Lee/28/0/0/0 |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 Not sure, but I think self.old_leader is used in methods to get class variables? So you are implying I should add 'self.' to all the 'old_leader's (and 'leader's)?
In that case I did that, and it... |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 You were probably right, I got that working now. Thank you so much for helping.
Now the first problem seem to almost repeat itself.
#modules
import random, time, sys
class... |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 I feel stupid. Why brackets? Because it's syntax for calling a class method in python I guess. I have now gotten rid of the globals.
New problem arrives. "'Competitions' object is not iterable"
... |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 I'm all for easy :). I'm probably missing something, but I can't see what. This is what I did so far:
#modules
import random, time, sys
class Competitions(object):
def __init__(self):
... |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 Thank you for replying! Just some questions.
Do I take every function and make it a method in the Competitions class? Even main()? Because that's what I've done now and the executer says "unbound... |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 I tried removing the global variable 'old_leader' and putting it as a parameter in every function that it involves but then it kept returning the value 0... Do you think something like that is the... |
Forum: Python Aug 27th, 2009 |
| Replies: 17 Views: 561 Hi!
I've made a small program for an assignment and it works as it should. There's just one problem; the code contains two global variables. I won't pass the course unless I get rid of them and... |
Forum: Python Nov 29th, 2008 |
| Replies: 2 Views: 523 Awesome, thank you Chris! |
Forum: Python Nov 29th, 2008 |
| Replies: 2 Views: 523 Greetings. I'm a python noob and I'm stuck with some coding.
Say you have a list with a number of elements, some of which are the same. For instance:
mylist = ['blue', 'red', 'green', 'green',... |