-
class Test:
-
def __init__(self):
-
self._power = False
-
self._v = 5
-
self._station = 80.0
-
self._presets= [ 72.0, 74.4, 76.6]
-
-
def togglePower(self): # when I tried it this did not work
-
self._powerOn = not self._PowerOn
-
-
def setPreset(self, ind):
-
self._presets[ind]=self_station #when I enter .setPreset(1), it did not work either, global name '_station' is not defined
-
-
5 1148 -
class Test:
-
def __init__(self):
-
self._power = False
-
self._v = 5
-
self._station = 80.0
-
self._presets= [ 72.0, 74.4, 76.6]
-
-
def togglePower(self): # when I tried it this did not work
-
self._powerOn = not self._PowerOn
-
-
def setPreset(self, ind):
-
self._presets[ind]=self_station #when I enter .setPreset(1), it did not work either, global name '_station' is not defined
-
-
-
class Test:
-
def __init__(self):
-
self._power = False
-
self._v = 5
-
self._station = 80.0
-
self._presets= [ 72.0, 74.4, 76.6]
-
-
def togglePower(self): # when I tried it this did not work
-
self._powerOn = not self._PowerOn
-
-
def setPreset(self, ind):
-
self._presets[ind]=self._station
-
-
you left out the "." after self and before _station.
-
class Test:
-
def __init__(self):
-
self._power = False
-
self._v = 5
-
self._station = 80.0
-
self._presets= [ 72.0, 74.4, 76.6]
-
-
def togglePower(self):
-
self._powerOn = not self._powerOn
-
-
Thank you very much.
Another question, how can it make the following code return "True" -
def togglePower(self):
-
self._powerOn = not self._powerOn
-
It only return "none" when I try -
class Test:
-
def __init__(self):
-
self._power = False
-
self._v = 5
-
self._station = 80.0
-
self._presets= [ 72.0, 74.4, 76.6]
-
-
def togglePower(self):
-
self._powerOn = not self._powerOn
-
-
Thank you very much.
Another question, how can it make the following code return "True" -
def togglePower(self):
-
self._powerOn = not self._powerOn
-
It only return "none" when I try -
def togglePower(self):
-
self._power = not self._power
-
return self._power
-
print a.togglePower()
-
Thank you.
Another question related to the one below, can anyone locate the error in the source code below? -
class Test:
-
def __init__(self):
-
self._powerOn = False
-
self._v = 10
-
self._station = 10
-
self._presets= [ 5, 6, 7, 8]
-
-
def togglePower(self):
-
self._powerOn = not self._powerOn
-
-
def setP(self, i):
-
self._presets[i]=self._station
-
-
def gotoP(self, i):
-
self._station = self._presets[i]
-
-
def increaseV(self):
-
self._v = self._v +2
-
-
def decreaseV(self):
-
self._v = self._v -2
-
-
def increaseStation(self):
-
self._station = self._station + 1
-
-
def decreaseStation(self):
-
self._station = self._station - 1
-
Thank you.
Another question related to the one below, can anyone locate the error in the source code below? -
class Test:
-
def __init__(self):
-
self._powerOn = False
-
self._v = 10
-
self._station = 10
-
self._presets= [ 5, 6, 7, 8]
-
-
def togglePower(self):
-
self._powerOn = not self._powerOn
-
-
def setP(self, i):
-
self._presets[i]=self._station
-
-
def gotoP(self, i):
-
self._station = self._presets[i]
-
-
def increaseV(self):
-
self._v = self._v +2
-
-
def decreaseV(self):
-
self._v = self._v -2
-
-
def increaseStation(self):
-
self._station = self._station + 1
-
-
def decreaseStation(self):
-
self._station = self._station - 1
-
It will be hard for us to tell without an example of which error you are getting. I do see that - # these two
-
-
def setP(self, i):
-
self._presets[i]=self._station
-
-
def gotoP(self, i):
-
self._station = self._presets[i]
will raise an error if you call the funtion with a number greater that 3.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Brandon J. Van Every |
last post by:
What's better about Ruby than Python? I'm sure there's something. What is
it?
This is not a troll. I'm language shopping and I want people's answers. I
don't know beans about Ruby or have...
|
by: E. Robert Tisdale |
last post by:
What makes a good C/C++ programmer?
Would you be surprised if I told you that
it has almost nothing to do with your knowledge of C or C++?
There isn't much difference in productivity, for...
|
by: Micha |
last post by:
Hello there,
I think I've run into some classic c++ pitfall and maybe some of
you guys can help me out.
For my project I will need to use matrices and vectors and so I
decided to implement them...
|
by: Jason Huang |
last post by:
Hi,
Would someone explain the following coding more detail for me? What's the
( ) for?
CurrentText = (TextBox)e.Item.Cells.Controls;
Thanks.
Jason
|
by: Midnight Java Junkie |
last post by:
Dear Colleagues:
I feel that the dumbest questions are those that are never asked. I have
been given the opportunity to get into .NET. Our organization has a
subscription with Microsoft that...
|
by: Xah Lee |
last post by:
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic...
|
by: Ltez |
last post by:
I use Python 2.4.4. Please read the code below:
-----------------------------------------------------------
from new import classobj
def mymeta(name,bases,clsdict):
print 'meta: %s'%name...
|
by: Mohamed Mansour |
last post by:
Hey there, this will be somewhat a long post, but any response is
appreciated!
I have done many PInvoke in the past from C++ to C#, but I did PInvoke
within C# not C++/CLI.
Can someone explain...
|
by: Vols |
last post by:
class A{
public:
int x;
};
class B : public A{
public:
int y;
};
void foo()
|
by: darren |
last post by:
Hi
I have to write a multi-threaded program. I decided to take an OO
approach to it. I had the idea to wrap up all of the thread functions
in a mix-in class called Threadable. Then when an...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |